Strip tabs and trailing white spaces, and fix end of files (#748)

* format: Strip trailing whitespaces

We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.

Commit was generated with:

    pre-commit run --all-files trailing-whitespace

* format: Files should have exactly one new line end of them

It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.

Commit was generated with:

    pre-commit run --all-files end-of-file-fixer

* format: Convert tabs to spaces

Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.

Commit was generated with:

    pre-commit run --all-files remove-tabs

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-25 22:13:57 +03:00
committed by GitHub
parent 9e0657424e
commit 369da70f2a
455 changed files with 7147 additions and 7249 deletions
+1 -2
View File
@@ -30,7 +30,7 @@ SHELL ["/bin/bash", "-c"]
RUN set -xe; \ RUN set -xe; \
apt-get update; apt-get upgrade -y; apt-get --purge autoremove -y; \ apt-get update; apt-get upgrade -y; apt-get --purge autoremove -y; \
apt-get install -y build-essential curl; \ apt-get install -y build-essential curl; \
apt-get -y autoclean; apt-get -y clean apt-get -y autoclean; apt-get -y clean
RUN set -euxo pipefail; \ RUN set -euxo pipefail; \
mkdir -p /build/bin; \ mkdir -p /build/bin; \
@@ -50,4 +50,3 @@ COPY --from=builder /build/bin/* /opt/bacnet/bin/
EXPOSE 47808/udp EXPOSE 47808/udp
ENTRYPOINT ["/opt/bacnet/bin/bacserv"] ENTRYPOINT ["/opt/bacnet/bin/bacserv"]
CMD ["1234", "test_server"] CMD ["1234", "test_server"]
-1
View File
@@ -459,4 +459,3 @@ fuzz-afl: $(BACNET_LIB_TARGET)
.PHONY: writepropm .PHONY: writepropm
writepropm: $(BACNET_LIB_TARGET) writepropm: $(BACNET_LIB_TARGET)
$(MAKE) -B -C $@ $(MAKE) -B -C $@
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -53,4 +53,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -90,4 +90,3 @@ A simplistic bacnet.sh script will look like this (with stdout/stderr to /dev/nu
#!/bin/bash #!/bin/bash
/home/pi/bacnet-stack/bin/bacblinkt 9009 > /dev/null 2>&1 /home/pi/bacnet-stack/bin/bacblinkt 9009 > /dev/null 2>&1
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
+3 -3
View File
@@ -29,11 +29,11 @@
* device-instance. Format is "C0:A8:00:18:BA:C0" (as usual) * device-instance. Format is "C0:A8:00:18:BA:C0" (as usual)
* *
* Examples: * Examples:
* ./bacepics -v 1234 * ./bacepics -v 1234
* where the device instance to be addressed is 1234 * where the device instance to be addressed is 1234
* and the optional -v prints values out rather than the '?' that * and the optional -v prints values out rather than the '?' that
* the EPICS format for VTS3 wants. * the EPICS format for VTS3 wants.
* ./bacepics -p 0xBAC1 -t "7F:0:0:1:BA:C0" 4194303 * ./bacepics -p 0xBAC1 -t "7F:0:0:1:BA:C0" 4194303
* communicates with the BACnet device on localhost (127.0.0.1), using * communicates with the BACnet device on localhost (127.0.0.1), using
* port 47809 as "my" source port so it doesn't conflict with * port 47809 as "my" source port so it doesn't conflict with
* the device's port 47808. * the device's port 47808.
@@ -54,7 +54,7 @@
* properties to be accessed. * properties to be accessed.
* - If the Fetch All succeeded, print the values for each property * - If the Fetch All succeeded, print the values for each property
* - Otherwise, for each property in the list for this object, * - Otherwise, for each property in the list for this object,
* - Request the single property value with ReadProperty (RP) * - Request the single property value with ReadProperty (RP)
* - From the response, print the property's value * - From the response, print the property's value
* The Device Object will have fetched the Object List property and built a list * The Device Object will have fetched the Object List property and built a list
* of objects from that; use it now to cycle through each other Object and * of objects from that; use it now to cycle through each other Object and
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-3
View File
@@ -19,6 +19,3 @@ Caveats:
* This builds the target with ASAN (Address Sanitizer). This makes AFL require the `-m none` to not interpret ASAN's behavior as a crash * This builds the target with ASAN (Address Sanitizer). This makes AFL require the `-m none` to not interpret ASAN's behavior as a crash
* AFL uses a fork/exec model to launch the target. This is nice because each testcase is from a clean state. But this also brings in a lot of overhead. If you need something faster, check out ../fuzz-libfuzzer/ * AFL uses a fork/exec model to launch the target. This is nice because each testcase is from a clean state. But this also brings in a lot of overhead. If you need something faster, check out ../fuzz-libfuzzer/
+4 -5
View File
@@ -17,12 +17,12 @@ INFO: seed corpus: files: 5790 min: 1b max: 483b total: 305068b rss: 40Mb
NPDU: Decoding failed; Discarded! NPDU: Decoding failed; Discarded!
... ...
NPDU: DNET=65280. Discarded! NPDU: DNET=65280. Discarded!
#5867 REDUCE cov: 208 ft: 249 corp: 66/1273b lim: 115 exec/s: 2933 rss: 106Mb L: 12/109 MS: 1 EraseBytes- #5867 REDUCE cov: 208 ft: 249 corp: 66/1273b lim: 115 exec/s: 2933 rss: 106Mb L: 12/109 MS: 1 EraseBytes-
Received Reserved for Use by ASHRAE Received Reserved for Use by ASHRAE
WP: Failed to send PDU (Success)! WP: Failed to send PDU (Success)!
NEW_FUNC[1/3]: 0x55a0d533f98a in abort_encode_apdu /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/abort.c:149 NEW_FUNC[1/3]: 0x55a0d533f98a in abort_encode_apdu /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/abort.c:149
NEW_FUNC[2/3]: 0x55a0d538f29a in wp_decode_service_request /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/wp.c:113 NEW_FUNC[2/3]: 0x55a0d538f29a in wp_decode_service_request /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/wp.c:113
#5940 NEW cov: 216 ft: 257 corp: 68/1282b lim: 115 exec/s: 2970 rss: 106Mb L: 6/109 MS: 2 EraseBytes-ChangeBit- #5940 NEW cov: 216 ft: 257 corp: 68/1282b lim: 115 exec/s: 2970 rss: 106Mb L: 6/109 MS: 2 EraseBytes-ChangeBit-
Received Reserved for Use by ASHRAE Received Reserved for Use by ASHRAE
... ...
================================================================= =================================================================
@@ -48,4 +48,3 @@ READ of size 1 at 0x60200003b656 thread T0
Caveat: Caveat:
* Libfuzzer does not reinitialize the target on each testcase. This means that it will be much quicker than ../fuzz-afl/, BUT it will also be a little less stable. It also will not continue to fuzz after a crash is found (since the libfuzzer runtime shares a process with the target that just crashed). There may be some command line options to adopt a fork model. * Libfuzzer does not reinitialize the target on each testcase. This means that it will be much quicker than ../fuzz-afl/, BUT it will also be a little less stable. It also will not continue to fuzz after a crash is found (since the libfuzzer runtime shares a process with the target that just crashed). There may be some command line options to adopt a fork model.
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
+47 -47
View File
@@ -16,68 +16,68 @@
<ul> <ul>
<li><a href="#name">NAME</a></li> <li><a href="#name">NAME</a></li>
<li><a href="#description">DESCRIPTION</a></li> <li><a href="#description">DESCRIPTION</a></li>
<li><a href="#options">OPTIONS</a></li> <li><a href="#options">OPTIONS</a></li>
<li><a href="#this_tool_s_api">This tool's API</a></li> <li><a href="#this_tool_s_api">This tool's API</a></li>
<ul> <ul>
<li><a href="#readproperty">ReadProperty</a></li> <li><a href="#readproperty">ReadProperty</a></li>
<ul> <ul>
<li><a href="#inputs_to_readproperty">Inputs to ReadProperty</a></li> <li><a href="#inputs_to_readproperty">Inputs to ReadProperty</a></li>
<li><a href="#outputs_from_readproperty">Outputs from ReadProperty</a></li> <li><a href="#outputs_from_readproperty">Outputs from ReadProperty</a></li>
<li><a href="#example_of_readproperty">Example of ReadProperty</a></li> <li><a href="#example_of_readproperty">Example of ReadProperty</a></li>
</ul> </ul>
<li><a href="#readpropertymultiple">ReadPropertyMultiple</a></li> <li><a href="#readpropertymultiple">ReadPropertyMultiple</a></li>
<ul> <ul>
<li><a href="#inputs_to_readpropertymultiple">Inputs to ReadPropertyMultiple</a></li> <li><a href="#inputs_to_readpropertymultiple">Inputs to ReadPropertyMultiple</a></li>
<li><a href="#outputs_from_readpropertymultiple">Outputs from ReadPropertyMultiple</a></li> <li><a href="#outputs_from_readpropertymultiple">Outputs from ReadPropertyMultiple</a></li>
<li><a href="#example_of_readpropertymultiple">Example of ReadPropertyMultiple</a></li> <li><a href="#example_of_readpropertymultiple">Example of ReadPropertyMultiple</a></li>
</ul> </ul>
<li><a href="#writeproperty">WriteProperty</a></li> <li><a href="#writeproperty">WriteProperty</a></li>
<ul> <ul>
<li><a href="#inputs_to_writeproperty">Inputs to WriteProperty</a></li> <li><a href="#inputs_to_writeproperty">Inputs to WriteProperty</a></li>
<li><a href="#outputs_from_writeproperty">Outputs from WriteProperty</a></li> <li><a href="#outputs_from_writeproperty">Outputs from WriteProperty</a></li>
<li><a href="#example_of_writeproperty">Example of WriteProperty</a></li> <li><a href="#example_of_writeproperty">Example of WriteProperty</a></li>
</ul> </ul>
<li><a href="#timesync">TimeSync</a></li> <li><a href="#timesync">TimeSync</a></li>
<ul> <ul>
<li><a href="#inputs_to_timesync">Inputs to TimeSync</a></li> <li><a href="#inputs_to_timesync">Inputs to TimeSync</a></li>
<li><a href="#outputs_from_timesync">Outputs from TimeSync</a></li> <li><a href="#outputs_from_timesync">Outputs from TimeSync</a></li>
<li><a href="#example_of_timesync">Example of TimeSync</a></li> <li><a href="#example_of_timesync">Example of TimeSync</a></li>
</ul> </ul>
<li><a href="#log">Log</a></li> <li><a href="#log">Log</a></li>
<ul> <ul>
<li><a href="#inputs_to_log">Inputs to Log</a></li> <li><a href="#inputs_to_log">Inputs to Log</a></li>
<li><a href="#example_of_log">Example of Log</a></li> <li><a href="#example_of_log">Example of Log</a></li>
</ul> </ul>
<li><a href="#silencelog">SilenceLog</a></li> <li><a href="#silencelog">SilenceLog</a></li>
<ul> <ul>
<li><a href="#inputs_to_silencelog">Inputs to SilenceLog</a></li> <li><a href="#inputs_to_silencelog">Inputs to SilenceLog</a></li>
<li><a href="#outputs_from_silencelog">Outputs from SilenceLog</a></li> <li><a href="#outputs_from_silencelog">Outputs from SilenceLog</a></li>
<li><a href="#example_of_silencelog">Example of SilenceLog</a></li> <li><a href="#example_of_silencelog">Example of SilenceLog</a></li>
</ul> </ul>
<li><a href="#retry">Retry</a></li> <li><a href="#retry">Retry</a></li>
<ul> <ul>
<li><a href="#inputs_to_retry">Inputs to Retry</a></li> <li><a href="#inputs_to_retry">Inputs to Retry</a></li>
<li><a href="#outputs_from_retry">Outputs from Retry</a></li> <li><a href="#outputs_from_retry">Outputs from Retry</a></li>
<li><a href="#example_of_retry">Example of Retry</a></li> <li><a href="#example_of_retry">Example of Retry</a></li>
</ul> </ul>
</ul> </ul>
</ul> </ul>
+9 -9
View File
@@ -39,37 +39,37 @@ ul {
} }
.quotedString .quotedString
{ {
color: #0000FF; color: #0000FF;
} }
.comment .comment
{ {
color: #999999; color: #999999;
} }
.operator .operator
{ {
color: #00CCCC; color: #00CCCC;
} }
.builtinVariable .builtinVariable
{ {
color: #CCCC00; color: #CCCC00;
} }
.variableSpecifier .variableSpecifier
{ {
color: #FF0000; color: #FF0000;
} }
.keyword .keyword
{ {
color: #AA0033; color: #AA0033;
} }
.builtinFunction .builtinFunction
{ {
color: #AA00AA; color: #AA00AA;
} }
.identifier .identifier
{ {
color: #009900; color: #009900;
} }
.number .number
{ {
color: #9999FF; color: #9999FF;
} }
+38 -39
View File
@@ -86,46 +86,46 @@ var classes = new Array("quotedString", "comment", "operator", "builtinVariable
*/ */
function HighlightCode(object) function HighlightCode(object)
{ {
codeText = object.innerText; //HTML.replace(/<.*?>/g, ""); codeText = object.innerText; //HTML.replace(/<.*?>/g, "");
object.innerHTML = ''; object.innerHTML = '';
var left; var left;
var match; var match;
var right; var right;
while (codeText.length > 0) while (codeText.length > 0)
{ {
var mode = -1 ; var mode = -1 ;
var index = 999999999; var index = 999999999;
for (var i = 0; i < RE.length; i++) for (var i = 0; i < RE.length; i++)
{ {
if ((codeText.match(RE[i])) && (RegExp.leftContext.length < index)) if ((codeText.match(RE[i])) && (RegExp.leftContext.length < index))
{ {
left = RegExp.leftContext; left = RegExp.leftContext;
match = RegExp.lastMatch; match = RegExp.lastMatch;
right = RegExp.rightContext; right = RegExp.rightContext;
index = RegExp.leftContext.length; index = RegExp.leftContext.length;
mode = i; mode = i;
} }
} }
if (mode == -1) if (mode == -1)
{ {
object.appendChild(document.createTextNode(codeText)); //.replace(/\r\n/g, "\r"))); object.appendChild(document.createTextNode(codeText)); //.replace(/\r\n/g, "\r")));
codeText = ''; codeText = '';
} }
else else
{ {
// append the plain text to the <code> block // append the plain text to the <code> block
object.appendChild(document.createTextNode(left)); //.replace(/\r\n/g, "\r"))); object.appendChild(document.createTextNode(left)); //.replace(/\r\n/g, "\r")));
// create a new <span> with the current code // create a new <span> with the current code
var span = document.createElement("span"); var span = document.createElement("span");
span.setAttribute("className", classes[mode]); // ie span.setAttribute("className", classes[mode]); // ie
span.setAttribute("class", classes[mode]); //mozilla span.setAttribute("class", classes[mode]); //mozilla
span.appendChild(document.createTextNode(match)); span.appendChild(document.createTextNode(match));
object.appendChild(span); object.appendChild(span);
codeText = right; codeText = right;
} }
} }
} }
// little bit of JQuery to highlight code in all pre elements // little bit of JQuery to highlight code in all pre elements
@@ -134,4 +134,3 @@ $(document).ready(function(){
HighlightCode(this); HighlightCode(this);
}); });
}); });
-1
View File
@@ -866,4 +866,3 @@ sub LogAnswer {
$answer = '' unless $append; $answer = '' unless $append;
$answer .= $newAnswer; $answer .= $newAnswer;
} }
-2
View File
@@ -16,5 +16,3 @@ The BACnet Scriptable (using Perl) Tool.
Value) for Device at instance 1234 run the following command Value) for Device at instance 1234 run the following command
perl bacnet.pl --script example_readprop.pl -- 1234 perl bacnet.pl --script example_readprop.pl -- 1234
-1
View File
@@ -56,4 +56,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -17,4 +17,3 @@ fi
make -C libmcp23s17 make -C libmcp23s17
make -C libpifacedigital make -C libpifacedigital
-2
View File
@@ -6,5 +6,3 @@ To build, start with the configure script:
$ ./configure.sh $ ./configure.sh
$ make clean all $ make clean all
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
+3 -3
View File
@@ -565,7 +565,7 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
* @param src [in] The routing source information, if any. * @param src [in] The routing source information, if any.
* If src->net and src->len are 0, there is no routing source information. * If src->net and src->len are 0, there is no routing source information.
* @param npdu_data [in] Contains a filled-out structure with information * @param npdu_data [in] Contains a filled-out structure with information
* decoded from the NCPI and other NPDU bytes. * decoded from the NCPI and other NPDU bytes.
* @param npdu [in] Buffer containing the rest of the NPDU, following the * @param npdu [in] Buffer containing the rest of the NPDU, following the
* bytes that have already been decoded. * bytes that have already been decoded.
* @param npdu_len [in] The length of the remaining NPDU message in npdu[]. * @param npdu_len [in] The length of the remaining NPDU message in npdu[].
@@ -618,7 +618,7 @@ static void who_is_router_to_network_handler(uint16_t snet,
* @param src [in] The routing source information, if any. * @param src [in] The routing source information, if any.
* If src->net and src->len are 0, there is no routing source information. * If src->net and src->len are 0, there is no routing source information.
* @param npdu_data [in] Contains a filled-out structure with information * @param npdu_data [in] Contains a filled-out structure with information
* decoded from the NCPI and other NPDU bytes. * decoded from the NCPI and other NPDU bytes.
* @param npdu [in] Buffer containing the rest of the NPDU, following the * @param npdu [in] Buffer containing the rest of the NPDU, following the
* bytes that have already been decoded. * bytes that have already been decoded.
* @param npdu_len [in] The length of the remaining NPDU message in npdu[]. * @param npdu_len [in] The length of the remaining NPDU message in npdu[].
@@ -899,7 +899,7 @@ static void routed_apdu_handler(uint16_t snet,
while (port != NULL) { while (port != NULL) {
if (port->net != snet) { if (port->net != snet) {
datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0], datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0],
npdu_len + apdu_len); npdu_len + apdu_len);
} }
port = port->next; port = port->next;
} }
+3 -3
View File
@@ -586,7 +586,7 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
* @param src [in] The routing source information, if any. * @param src [in] The routing source information, if any.
* If src->net and src->len are 0, there is no routing source information. * If src->net and src->len are 0, there is no routing source information.
* @param npdu_data [in] Contains a filled-out structure with information * @param npdu_data [in] Contains a filled-out structure with information
* decoded from the NCPI and other NPDU bytes. * decoded from the NCPI and other NPDU bytes.
* @param npdu [in] Buffer containing the rest of the NPDU, following the * @param npdu [in] Buffer containing the rest of the NPDU, following the
* bytes that have already been decoded. * bytes that have already been decoded.
* @param npdu_len [in] The length of the remaining NPDU message in npdu[]. * @param npdu_len [in] The length of the remaining NPDU message in npdu[].
@@ -639,7 +639,7 @@ static void who_is_router_to_network_handler(uint16_t snet,
* @param src [in] The routing source information, if any. * @param src [in] The routing source information, if any.
* If src->net and src->len are 0, there is no routing source information. * If src->net and src->len are 0, there is no routing source information.
* @param npdu_data [in] Contains a filled-out structure with information * @param npdu_data [in] Contains a filled-out structure with information
* decoded from the NCPI and other NPDU bytes. * decoded from the NCPI and other NPDU bytes.
* @param npdu [in] Buffer containing the rest of the NPDU, following the * @param npdu [in] Buffer containing the rest of the NPDU, following the
* bytes that have already been decoded. * bytes that have already been decoded.
* @param npdu_len [in] The length of the remaining NPDU message in npdu[]. * @param npdu_len [in] The length of the remaining NPDU message in npdu[].
@@ -922,7 +922,7 @@ static void routed_apdu_handler(uint16_t snet,
while (port != NULL) { while (port != NULL) {
if (port->net != snet) { if (port->net != snet) {
datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0], datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0],
npdu_len + apdu_len); npdu_len + apdu_len);
} }
port = port->next; port = port->next;
} }
+50 -50
View File
@@ -2,67 +2,67 @@
configuration file that stores values for router ports initialization configuration file that stores values for router ports initialization
Common arguments: Common arguments:
device_type - "bip" or "mstp" (with quotes) device_type - "bip" or "mstp" (with quotes)
device - Connection device, for example "eth0" or "/dev/ttyS0" device - Connection device, for example "eth0" or "/dev/ttyS0"
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number network - Network number [1..65534]. Do not use network number 65535, it is broadcast number
bip arguments: bip arguments:
port - bip UDP port, default 47808 port - bip UDP port, default 47808
mstp arguments: mstp arguments:
mac - MSTP MAC mac - MSTP MAC
max_master - MSTP max master max_master - MSTP max master
max_frames - 1 max_frames - 1
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400 baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
parity - one from the list (with quotes): "None", "Even", "Odd" parity - one from the list (with quotes): "None", "Even", "Odd"
databits - one from the list: 5, 6, 7, 8 databits - one from the list: 5, 6, 7, 8
stopbits - 1 or 2 stopbits - 1 or 2
Example: Example:
ports = ports =
( (
{ {
device_type = "bip"; device_type = "bip";
device = "eth0"; device = "eth0";
port = 47808; port = 47808;
network = 1; network = 1;
}, },
{ {
device_type = "mstp"; device_type = "mstp";
device = "/dev/ttyS0"; device = "/dev/ttyS0";
mac = 1; mac = 1;
max_master = 127; max_master = 127;
max_frames = 1; max_frames = 1;
baud = 38400; baud = 38400;
parity = "None"; parity = "None";
databits = 8; databits = 8;
stopbits = 1; stopbits = 1;
network = 2; network = 2;
} }
); );
*/ */
ports = ports =
( (
{ {
device_type = "bip"; device_type = "bip";
device = "eth0"; device = "eth0";
port = 47808; port = 47808;
network = 1; network = 1;
}, },
{ {
device_type = "mstp"; device_type = "mstp";
device = "/dev/ttyS0"; device = "/dev/ttyS0";
mac = 2; mac = 2;
max_master = 127; max_master = 127;
max_frames = 1; max_frames = 1;
baud = 38400; baud = 38400;
parity = "None"; parity = "None";
databits = 8; databits = 8;
stopbits = 1; stopbits = 1;
network = 2; network = 2;
} }
); );
+3 -3
View File
@@ -17,9 +17,9 @@
#include "portthread.h" #include "portthread.h"
#include "bacnet/datalink/bip.h" #include "bacnet/datalink/bip.h"
#define MAX_BIP_APDU 1476 #define MAX_BIP_APDU 1476
#define MAX_BIP_PDU (MAX_NPDU + MAX_BIP_APDU) #define MAX_BIP_PDU (MAX_NPDU + MAX_BIP_APDU)
#define MAX_BIP_MPDU (BIP_HEADER_MAX + MAX_BIP_PDU) #define MAX_BIP_MPDU (BIP_HEADER_MAX + MAX_BIP_PDU)
/* Yes, we know this is longer than an Ethernet Frame, /* Yes, we know this is longer than an Ethernet Frame,
a UDP payload and an IPv6 packet. a UDP payload and an IPv6 packet.
Grandfathered in from BACnet Ethernet days, Grandfathered in from BACnet Ethernet days,
+64 -67
View File
@@ -32,90 +32,90 @@ SPDX-License-Identifier: MIT
//single line comment //single line comment
/* /*
multiline comment multiline comment
*/ */
ports = ports =
( (
//route_1 //route_1
{ {
device_type = "<value>"; device_type = "<value>";
//route specific arguments, see below //route specific arguments, see below
}, },
//route_2 //route_2
{ {
device_type = "<value>"; device_type = "<value>";
//route specific arguments, see below //route specific arguments, see below
}, },
//..... //.....
//route_n //route_n
{ {
device_type = "<value>"; device_type = "<value>";
//route specific arguments, see below //route specific arguments, see below
} }
); );
Note: - arguments are separeted with ';' Note: - arguments are separeted with ';'
- routes are separeted with ',' - routes are separeted with ','
- no ',' after the last route - no ',' after the last route
4.2. Configuration file arguments. 4.2. Configuration file arguments.
Common arguments: Common arguments:
device_type - Describes a type of route, may be "bip" (Etherent) or "mstp" (Serial port). Use quotes. device_type - Describes a type of route, may be "bip" (Etherent) or "mstp" (Serial port). Use quotes.
device - Connection device, for example "eth0" or "/dev/ttyS0"; default values: for BIP:"eth0", for MSTP: "/dev/ttyS0". Use quotes. device - Connection device, for example "eth0" or "/dev/ttyS0"; default values: for BIP:"eth0", for MSTP: "/dev/ttyS0". Use quotes.
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number; default begins from 1 to routes count. network - Network number [1..65534]. Do not use network number 65535, it is broadcast number; default begins from 1 to routes count.
bip arguments: bip arguments:
port - bip UDP port; default port is 47808 (0xBAC0). port - bip UDP port; default port is 47808 (0xBAC0).
mstp arguments: mstp arguments:
mac - MSTP MAC; default value is 127. mac - MSTP MAC; default value is 127.
max_master - MSTP max master; default value is 127. max_master - MSTP max master; default value is 127.
max_frames - 1. Segmentation does not supported. max_frames - 1. Segmentation does not supported.
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400; default baud is 9600 baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400; default baud is 9600
parity - one from the list (with quotes): "None", "Even", "Odd"; default parity "None". Use quotes. parity - one from the list (with quotes): "None", "Even", "Odd"; default parity "None". Use quotes.
databits - one from the list: 5, 6, 7, 8; default 8. databits - one from the list: 5, 6, 7, 8; default 8.
stopbits - 1 or 2; default 1. stopbits - 1 or 2; default 1.
4.3. Example of configuration file. 4.3. Example of configuration file.
ports = ports =
( (
{ {
device_type = "bip"; device_type = "bip";
device = "eth0"; device = "eth0";
port = 47808; port = 47808;
network = 1; network = 1;
}, },
{ {
device_type = "bip"; device_type = "bip";
device = "eth1"; device = "eth1";
port = 47808; port = 47808;
network = 2; network = 2;
}, },
{ {
device_type = "bip"; device_type = "bip";
device = "eth1"; device = "eth1";
port = 47809; port = 47809;
network = 3; network = 3;
}, },
{ {
device_type = "mstp"; device_type = "mstp";
device = "/dev/ttyS0"; device = "/dev/ttyS0";
mac = 1; mac = 1;
max_master = 127; max_master = 127;
max_frames = 1; max_frames = 1;
baud = 38400; baud = 38400;
parity = "None"; parity = "None";
databits = 8; databits = 8;
stopbits = 1; stopbits = 1;
network = 4; network = 4;
} }
); );
----------------------- -----------------------
5. Start 5. Start
@@ -127,6 +127,3 @@ mstp arguments:
5.2. Passing params in command line 5.2. Passing params in command line
1. sudo ./router -D "mstp" "/dev/ttyS0" --mac 1 127 1 --baud 38400 --network 4 -D "bip" "eth0" --network 1 1. sudo ./router -D "mstp" "/dev/ttyS0" --mac 1 127 1 --baud 38400 --network 4 -D "bip" "eth0" --network 1
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -42,4 +42,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -42,4 +42,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -75,4 +75,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-2
View File
@@ -755,5 +755,3 @@ List of Objects in test device:
} }
End of BACnet Protocol Implementation Conformance Statement End of BACnet Protocol Implementation Conformance Statement
+9 -9
View File
@@ -179,15 +179,15 @@ static void Init_Service_Handlers(void)
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has); apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
#if 0 #if 0
/* BACnet Testing Observed Incident oi00107 /* BACnet Testing Observed Incident oi00107
Server only devices should not indicate that they EXECUTE I-Am Server only devices should not indicate that they EXECUTE I-Am
Revealed by BACnet Test Client v1.8.16 ( www.bac-test.com/bacnet-test-client-download ) Revealed by BACnet Test Client v1.8.16 ( www.bac-test.com/bacnet-test-client-download )
BITS: BIT00040 BITS: BIT00040
Any discussions can be directed to edward@bac-test.com Any discussions can be directed to edward@bac-test.com
Please feel free to remove this comment when my changes accepted after suitable time for Please feel free to remove this comment when my changes accepted after suitable time for
review by all interested parties. Say 6 months -> September 2016 */ review by all interested parties. Say 6 months -> September 2016 */
/* In this demo, we are the server only ( BACnet "B" device ) so we do not indicate /* In this demo, we are the server only ( BACnet "B" device ) so we do not indicate
that we can execute the I-Am message */ that we can execute the I-Am message */
/* handle i-am to support binding to other devices */ /* handle i-am to support binding to other devices */
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind); apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
#endif #endif
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -37,4 +37,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -40,4 +40,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -40,4 +40,3 @@ clean:
.PHONY: include .PHONY: include
include: .depend include: .depend
-1
View File
@@ -51,4 +51,3 @@ package "codespell"
# you can also execute arbitrary bash # you can also execute arbitrary bash
echo "🚀 ALL GOOD TO GO" echo "🚀 ALL GOOD TO GO"
+103 -105
View File
@@ -32,116 +32,114 @@ done
shift $(($OPTIND -1)) shift $(($OPTIND -1))
if [ $# -eq 0 ] || [ "$1" = "" ] ; then if [ $# -eq 0 ] || [ "$1" = "" ] ; then
usage usage
exit exit
fi fi
run_test() run_test()
{ {
echo -e -e "Test: Read Required Properties of Device Object $1\r" echo -e -e "Test: Read Required Properties of Device Object $1\r"
echo -n "OBJECT IDENTIFIER:" echo -n "OBJECT IDENTIFIER:"
./bacrp $1 8 $1 75 ./bacrp $1 8 $1 75
echo -n "OBJECT NAME:" echo -n "OBJECT NAME:"
./bacrp $1 8 $1 77 ./bacrp $1 8 $1 77
echo -n "OBJECT TYPE:" echo -n "OBJECT TYPE:"
./bacrp $1 8 $1 79 ./bacrp $1 8 $1 79
echo -n "SYSTEM STATUS:" echo -n "SYSTEM STATUS:"
./bacrp $1 8 $1 112 ./bacrp $1 8 $1 112
echo -n "VENDOR NAME:" echo -n "VENDOR NAME:"
./bacrp $1 8 $1 121 ./bacrp $1 8 $1 121
echo -n "VENDOR IDENTIFIER:" echo -n "VENDOR IDENTIFIER:"
./bacrp $1 8 $1 120 ./bacrp $1 8 $1 120
echo -n "MODEL NAME:" echo -n "MODEL NAME:"
./bacrp $1 8 $1 70 ./bacrp $1 8 $1 70
echo -n "FIRMWARE REVISION:" echo -n "FIRMWARE REVISION:"
./bacrp $1 8 $1 44 ./bacrp $1 8 $1 44
echo -n "APPLICATION SOFTWARE VERSION:" echo -n "APPLICATION SOFTWARE VERSION:"
./bacrp $1 8 $1 12 ./bacrp $1 8 $1 12
echo -n "PROTOCOL VERSION:" echo -n "PROTOCOL VERSION:"
./bacrp $1 8 $1 98 ./bacrp $1 8 $1 98
echo -n "PROTOCOL REVISION:" echo -n "PROTOCOL REVISION:"
./bacrp $1 8 $1 139 ./bacrp $1 8 $1 139
echo -n "PROTOCOL SERVICES SUPPORTED:" echo -n "PROTOCOL SERVICES SUPPORTED:"
./bacrp $1 8 $1 97 ./bacrp $1 8 $1 97
echo -n "OBJECT TYPES SUPPORTED:" echo -n "OBJECT TYPES SUPPORTED:"
./bacrp $1 8 $1 96 ./bacrp $1 8 $1 96
echo -n "OBJECT LIST LENGTH:" echo -n "OBJECT LIST LENGTH:"
./bacrp $1 8 $1 76 0 ./bacrp $1 8 $1 76 0
echo -n "OBJECT LIST:" echo -n "OBJECT LIST:"
./bacrp $1 8 $1 76 ./bacrp $1 8 $1 76
echo -n "MAX APDU LENGTH ACCEPTED:" echo -n "MAX APDU LENGTH ACCEPTED:"
./bacrp $1 8 $1 62 ./bacrp $1 8 $1 62
echo -n "SEGMENTATION SUPPORTED:" echo -n "SEGMENTATION SUPPORTED:"
./bacrp $1 8 $1 107 ./bacrp $1 8 $1 107
echo -n "APDU TIMEOUT:" echo -n "APDU TIMEOUT:"
./bacrp $1 8 $1 11 ./bacrp $1 8 $1 11
echo -n "NUMGER OF APDU ENTRIES:" echo -n "NUMGER OF APDU ENTRIES:"
./bacrp $1 8 $1 73 ./bacrp $1 8 $1 73
echo -n "DEVICE ADDRESS BINDING:" echo -n "DEVICE ADDRESS BINDING:"
./bacrp $1 8 $1 30 ./bacrp $1 8 $1 30
echo -n "DATABASE REVISION:" echo -n "DATABASE REVISION:"
./bacrp $1 8 $1 155 ./bacrp $1 8 $1 155
if [ $OPTIONAL -eq 1 ] ; then if [ $OPTIONAL -eq 1 ] ; then
echo -e "Test: Read Optional Properties of Device Object $1\r" echo -e "Test: Read Optional Properties of Device Object $1\r"
echo -n "LOCATION:" echo -n "LOCATION:"
./bacrp $1 8 $1 58 ./bacrp $1 8 $1 58
echo -n "DESCRIPTION:" echo -n "DESCRIPTION:"
./bacrp $1 8 $1 28 ./bacrp $1 8 $1 28
echo -n "MAX SEGMENTS SUPPORTED:" echo -n "MAX SEGMENTS SUPPORTED:"
./bacrp $1 8 $1 167 ./bacrp $1 8 $1 167
echo -n "VT CLASSES SUPPORTED:" echo -n "VT CLASSES SUPPORTED:"
./bacrp $1 8 $1 122 ./bacrp $1 8 $1 122
echo -n "ACTIVE VT SESSIONS:" echo -n "ACTIVE VT SESSIONS:"
./bacrp $1 8 $1 5 ./bacrp $1 8 $1 5
echo -n "LOCAL TIME:" echo -n "LOCAL TIME:"
./bacrp $1 8 $1 57 ./bacrp $1 8 $1 57
echo -n "LOCAL DATE:" echo -n "LOCAL DATE:"
./bacrp $1 8 $1 56 ./bacrp $1 8 $1 56
echo -n "UTC OFFSET:" echo -n "UTC OFFSET:"
./bacrp $1 8 $1 119 ./bacrp $1 8 $1 119
echo -n "DAYLIGHT SAVINGS STATUS:" echo -n "DAYLIGHT SAVINGS STATUS:"
./bacrp $1 8 $1 24 ./bacrp $1 8 $1 24
echo -n "APDU SEGMENT TIMEOUT:" echo -n "APDU SEGMENT TIMEOUT:"
./bacrp $1 8 $1 10 ./bacrp $1 8 $1 10
echo -n "LIST OF SESSION KEYS:" echo -n "LIST OF SESSION KEYS:"
./bacrp $1 8 $1 55 ./bacrp $1 8 $1 55
echo -n "TIME SYNCHRONIZATION RECIPIENTS:" echo -n "TIME SYNCHRONIZATION RECIPIENTS:"
./bacrp $1 8 $1 116 ./bacrp $1 8 $1 116
echo -n "MAX MASTER:" echo -n "MAX MASTER:"
./bacrp $1 8 $1 64 ./bacrp $1 8 $1 64
echo -n "MAX INFO FRAMES:" echo -n "MAX INFO FRAMES:"
./bacrp $1 8 $1 63 ./bacrp $1 8 $1 63
echo -n "ACK REQUIRED:" echo -n "ACK REQUIRED:"
./bacrp $1 8 $1 1 ./bacrp $1 8 $1 1
echo -n "CONFIGURATION FILES:" echo -n "CONFIGURATION FILES:"
./bacrp $1 8 $1 154 ./bacrp $1 8 $1 154
echo -n "LAST RESTORE TIME:" echo -n "LAST RESTORE TIME:"
./bacrp $1 8 $1 157 ./bacrp $1 8 $1 157
echo -n "BACKUP FAILURE TIMEOUT:" echo -n "BACKUP FAILURE TIMEOUT:"
./bacrp $1 8 $1 153 ./bacrp $1 8 $1 153
echo -n "ACTIVE COV SUBSCRIPTIONS:" echo -n "ACTIVE COV SUBSCRIPTIONS:"
./bacrp $1 8 $1 152 ./bacrp $1 8 $1 152
echo -n "SLAVE PROXY ENABLE:" echo -n "SLAVE PROXY ENABLE:"
./bacrp $1 8 $1 172 ./bacrp $1 8 $1 172
echo -n "MANUAL SLAVE ADDRESS BINDING:" echo -n "MANUAL SLAVE ADDRESS BINDING:"
./bacrp $1 8 $1 170 ./bacrp $1 8 $1 170
echo -n "AUTO SLAVE DISCOVERY:" echo -n "AUTO SLAVE DISCOVERY:"
./bacrp $1 8 $1 169 ./bacrp $1 8 $1 169
echo -n "SLAVE ADDRESS BINDING:" echo -n "SLAVE ADDRESS BINDING:"
./bacrp $1 8 $1 171 ./bacrp $1 8 $1 171
echo -n "PROFILE NAME:" echo -n "PROFILE NAME:"
./bacrp $1 8 $1 168 ./bacrp $1 8 $1 168
fi fi
echo -e " \r" echo -e " \r"
} }
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
ID=$(( $1 + 0 )) ID=$(( $1 + 0 ))
shift shift
if [ $ID -eq 0 ] ; then if [ $ID -eq 0 ] ; then
echo "ERROR: Device ID must be an integer!! [ID=$ID]" >&2 echo "ERROR: Device ID must be an integer!! [ID=$ID]" >&2
fi fi
run_test $ID run_test $ID
done done
+2 -3
View File
@@ -18,8 +18,8 @@ declare -A device
# capture the devices from the command line # capture the devices from the command line
for d in "$@" for d in "$@"
do do
device[${port_key}]=${d} device[${port_key}]=${d}
epics_port_max=$((port_key++)) epics_port_max=$((port_key++))
done done
# spawn the epics clients # spawn the epics clients
@@ -42,4 +42,3 @@ for pid in ${pids[*]}; do
done done
killall bacserv killall bacserv
-1
View File
@@ -11,4 +11,3 @@ echo they register as a Foreign Device to it.
@echo on @echo on
set BACNET_BBMD_PORT=47808 set BACNET_BBMD_PORT=47808
set BACNET_BBMD_ADDRESS=%1 set BACNET_BBMD_ADDRESS=%1
-1
View File
@@ -23,4 +23,3 @@ do
${CONVERTER} ${filename} > ${TEMPFILE} ${CONVERTER} ${filename} > ${TEMPFILE}
mv ${TEMPFILE} ${filename} mv ${TEMPFILE} ${filename}
done done
Vendored
-1
View File
@@ -1,3 +1,2 @@
#!/bin/sh #!/bin/sh
# Nothing to do # Nothing to do
-1
View File
@@ -158,4 +158,3 @@ Q-18: I have downloaded the BACnet stack but can't get Who-Is or EPICS applicati
A-18: Firewalls on modern OS block incoming and outgoing network traffic and require you to 'allow' the port that BACnet/IP uses. To allow the default BACnet/IP UDP port 47808 Linux with UFW: A-18: Firewalls on modern OS block incoming and outgoing network traffic and require you to 'allow' the port that BACnet/IP uses. To allow the default BACnet/IP UDP port 47808 Linux with UFW:
$ sudo ufw allow 47808/udp $ sudo ufw allow 47808/udp
-1
View File
@@ -5,4 +5,3 @@ Q1: Cannot open include file: 'winsock2.h'
A1: Install the Microsoft Platform SDK: A1: Install the Microsoft Platform SDK:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
+1 -1
View File
@@ -1,4 +1,4 @@
SLOC Directory SLOC-by-Language (Sorted) SLOC Directory SLOC-by-Language (Sorted)
118011 ports ansic=101988,asm=10755,cpp=4651,xml=463,sh=154 118011 ports ansic=101988,asm=10755,cpp=4651,xml=463,sh=154
78632 src_bacnet ansic=78632 78632 src_bacnet ansic=78632
28295 test ansic=27663,cpp=598,xml=34 28295 test ansic=27663,cpp=598,xml=34
-1
View File
@@ -45,4 +45,3 @@ AC:10:56:06:BA:C0=MAC address (router address) in hex
26001=DNET network number in decimal 26001=DNET network number in decimal
19=DADR MAC address in hex. Use colon to separate multibyte address. 19=DADR MAC address in hex. Use colon to separate multibyte address.
50=Max APDU 50=Max APDU
+45 -45
View File
@@ -34,10 +34,10 @@ for C++ headers and converts them.
Don't initialize variables in their declaration with non-constant Don't initialize variables in their declaration with non-constant
values. Not all compilers support this. E.g. don't use values. Not all compilers support this. E.g. don't use
uint32_t i = somearray[2]; uint32_t i = somearray[2];
use use
uint32_t i; uint32_t i;
i = somearray[2]; i = somearray[2];
instead. instead.
Don't use zero-length arrays; not all compilers support them. If an Don't use zero-length arrays; not all compilers support them. If an
@@ -76,43 +76,43 @@ unsigned integers.
Don't use a label without a statement following it. For example, Don't use a label without a statement following it. For example,
something such as something such as
if (...) { if (...) {
... ...
done: done:
} }
will not work with all compilers - you have to do will not work with all compilers - you have to do
if (...) { if (...) {
... ...
done: done:
; ;
} }
with some statements, even if it's a null statement, after the label. with some statements, even if it's a null statement, after the label.
Don't use "bzero()", "bcopy()", or "bcmp()"; instead, use the ANSI C Don't use "bzero()", "bcopy()", or "bcmp()"; instead, use the ANSI C
routines routines
"memset()" (with zero as the second argument, so that it sets "memset()" (with zero as the second argument, so that it sets
all the bytes to zero); all the bytes to zero);
"memcpy()" or "memmove()" (note that the first and second "memcpy()" or "memmove()" (note that the first and second
arguments to "memcpy()" are in the reverse order to the arguments to "memcpy()" are in the reverse order to the
arguments to "bcopy()"; note also that "bcopy()" is typically arguments to "bcopy()"; note also that "bcopy()" is typically
guaranteed to work on overlapping memory regions, while guaranteed to work on overlapping memory regions, while
"memcpy()" isn't, so if you may be copying from one region to a "memcpy()" isn't, so if you may be copying from one region to a
region that overlaps it, use "memmove()", not "memcpy()" - but region that overlaps it, use "memmove()", not "memcpy()" - but
"memcpy()" might be faster as a result of not guaranteeing "memcpy()" might be faster as a result of not guaranteeing
correct operation on overlapping memory regions); correct operation on overlapping memory regions);
and "memcmp()" (note that "memcmp()" returns 0, 1, or -1, doing and "memcmp()" (note that "memcmp()" returns 0, 1, or -1, doing
an ordered comparison, rather than just returning 0 for "equal" an ordered comparison, rather than just returning 0 for "equal"
and 1 for "not equal", as "bcmp()" does). and 1 for "not equal", as "bcmp()" does).
Not all platforms necessarily have "bzero()"/"bcopy()"/"bcmp()", and Not all platforms necessarily have "bzero()"/"bcopy()"/"bcmp()", and
those that do might not declare them in the header file on which they're those that do might not declare them in the header file on which they're
@@ -166,25 +166,25 @@ file is to be created if it doesn't exist), and OR in the O_BINARY flag.
That flag is not present on most, if not all, UNIX systems, so you must That flag is not present on most, if not all, UNIX systems, so you must
also do also do
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
to properly define it for UNIX (it's not necessary on UNIX). to properly define it for UNIX (it's not necessary on UNIX).
Don't use forward declarations of static arrays without a specified size Don't use forward declarations of static arrays without a specified size
in a fashion such as this: in a fashion such as this:
static const value_string foo_vals[]; static const value_string foo_vals[];
... ...
static const value_string foo_vals[] = { static const value_string foo_vals[] = {
{ 0, "Red" }, { 0, "Red" },
{ 1, "Green" }, { 1, "Green" },
{ 2, "Blue" }, { 2, "Blue" },
{ 0, NULL } { 0, NULL }
}; };
as some compilers will reject the first of those statements. Instead, as some compilers will reject the first of those statements. Instead,
initialize the array at the point at which it's first declared, so that initialize the array at the point at which it's first declared, so that
@@ -194,11 +194,11 @@ Don't put declarations in the middle of a block; put them before all
code. Not all compilers support declarations in the middle of code, code. Not all compilers support declarations in the middle of code,
such as such as
int i; int i;
i = foo(); i = foo();
int j; int j;
For #define names and enum member names, prefix the names with a tag so For #define names and enum member names, prefix the names with a tag so
as to avoid collisions with other names - this might be more of an issue as to avoid collisions with other names - this might be more of an issue
@@ -207,20 +207,20 @@ OPTIONAL.
Don't use "variadic macros", such as Don't use "variadic macros", such as
#define DBG(format, args...) fprintf(stderr, format, ## args) #define DBG(format, args...) fprintf(stderr, format, ## args)
as not all C compilers support them. Use macros that take a fixed as not all C compilers support them. Use macros that take a fixed
number of arguments, such as number of arguments, such as
#define DBG0(format) fprintf(stderr, format) #define DBG0(format) fprintf(stderr, format)
#define DBG1(format, arg1) fprintf(stderr, format, arg1) #define DBG1(format, arg1) fprintf(stderr, format, arg1)
#define DBG2(format, arg1, arg2) fprintf(stderr, format, arg1, arg2) #define DBG2(format, arg1, arg2) fprintf(stderr, format, arg1, arg2)
... ...
or something such as or something such as
#define DBG(args) printf args #define DBG(args) printf args
Instead of tmpnam(), use mkstemp(). tmpnam is insecure and should Instead of tmpnam(), use mkstemp(). tmpnam is insecure and should
not be used any more. Note: mkstemp does not accept NULL as a parameter. not be used any more. Note: mkstemp does not accept NULL as a parameter.
+2 -2
View File
@@ -1,8 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>BACnet stack - open source BACnet protocol stack</TITLE> <TITLE>BACnet stack - open source BACnet protocol stack</TITLE>
</HEAD> </HEAD>
<BODY LANG="en-US"> <BODY LANG="en-US">
<img src="images/BACnet.png" align=right> <img src="images/BACnet.png" align=right>
+12 -12
View File
@@ -17,15 +17,15 @@ Usage-Guide:
SPDX-License-Identifier: GPL-2.0-or-later SPDX-License-Identifier: GPL-2.0-or-later
License-Text: License-Text:
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
@@ -74,8 +74,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
@@ -129,7 +129,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
@@ -187,7 +187,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
@@ -244,7 +244,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
@@ -274,7 +274,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
NO WARRANTY NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -296,9 +296,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it possible use to the public, the best way to achieve this is to make it
+1 -1
View File
@@ -202,7 +202,7 @@ int bip_send_pdu(BACNET_ADDRESS *dest, /* destination address */
* *
* @param src [out] Source of the packet - who should receive any response. * @param src [out] Source of the packet - who should receive any response.
* @param pdu [out] A buffer to hold the PDU portion of the received packet, * @param pdu [out] A buffer to hold the PDU portion of the received packet,
* after the BVLC portion has been stripped * after the BVLC portion has been stripped
* off. * off.
* @param max_pdu [in] Size of the pdu[] buffer. * @param max_pdu [in] Size of the pdu[] buffer.
* @param timeout [in] The number of milliseconds to wait for a packet. * @param timeout [in] The number of milliseconds to wait for a packet.
-1
View File
@@ -13,4 +13,3 @@ monitor long 0xfffffc30 0x7
monitor sleep 100 monitor sleep 100
monitor long 0xfffffd08 0xa5000401 monitor long 0xfffffd08 0xa5000401
monitor sleep 100 monitor sleep 100
File diff suppressed because it is too large Load Diff
+32 -33
View File
@@ -2,8 +2,8 @@
/* LINKER SCRIPT */ /* LINKER SCRIPT */
/* */ /* */
/* */ /* */
/* The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are */ /* The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are */
/* to be loaded into memory (code goes into FLASH, variables go into RAM). */ /* to be loaded into memory (code goes into FLASH, variables go into RAM). */
/* */ /* */
/* Any symbols defined in the Linker Script are automatically global and available to the rest of the */ /* Any symbols defined in the Linker Script are automatically global and available to the rest of the */
/* program. */ /* program. */
@@ -11,7 +11,7 @@
/* To force the linker to use this LINKER SCRIPT, just add the -T AT91SAM7S256.LD */ /* To force the linker to use this LINKER SCRIPT, just add the -T AT91SAM7S256.LD */
/* directive to the linker flags in the makefile. For example, */ /* directive to the linker flags in the makefile. For example, */
/* */ /* */
/* LFLAGS = -Map main.map -nostartfiles -T AT91SAM7S256.LD */ /* LFLAGS = -Map main.map -nostartfiles -T AT91SAM7S256.LD */
/* */ /* */
/* */ /* */
/* The order that the object files are listed in the makefile determines what .text section is */ /* The order that the object files are listed in the makefile determines what .text section is */
@@ -19,10 +19,10 @@
/* */ /* */
/* For example: $(LD) $(LFLAGS) -o main.out crt.o main.o lowlevelinit.o */ /* For example: $(LD) $(LFLAGS) -o main.out crt.o main.o lowlevelinit.o */
/* */ /* */
/* crt.o is first in the list of objects, so it will be placed at address 0x00000000 */ /* crt.o is first in the list of objects, so it will be placed at address 0x00000000 */
/* */ /* */
/* */ /* */
/* The top of the stack (_stack_end) is (last_byte_of_ram +1) - 4 */ /* The top of the stack (_stack_end) is (last_byte_of_ram +1) - 4 */
/* */ /* */
/* Therefore: _stack_end = (0x00020FFFF + 1) - 4 = 0x00210000 - 4 = 0x0020FFFC */ /* Therefore: _stack_end = (0x00020FFFF + 1) - 4 = 0x00210000 - 4 = 0x0020FFFC */
/* Therefore: _stack_end = (0x000203FFF + 1) - 4 = 0x00204000 - 4 = 0x00203FFC */ /* Therefore: _stack_end = (0x000203FFF + 1) - 4 = 0x00204000 - 4 = 0x00203FFC */
@@ -57,7 +57,7 @@
/* . | SVC Stack 16 bytes | */ /* . | SVC Stack 16 bytes | */
/* . | | */ /* . | | */
/* . |---------------------------------|0x0020FECC */ /* . |---------------------------------|0x0020FECC */
/* . | | */ /* . | | */
/* . | stack area for user program | */ /* . | stack area for user program | */
/* . | | */ /* . | | */
/* . | | */ /* . | | */
@@ -112,8 +112,8 @@ ENTRY(_vec_reset)
/* specify the AT91SAM7S64 memory areas */ /* specify the AT91SAM7S64 memory areas */
MEMORY MEMORY
{ {
flash : ORIGIN = 0, LENGTH = 64K /* FLASH EPROM */ flash : ORIGIN = 0, LENGTH = 64K /* FLASH EPROM */
ram : ORIGIN = 0x00200000, LENGTH = 16K /* static RAM area */ ram : ORIGIN = 0x00200000, LENGTH = 16K /* static RAM area */
} }
@@ -124,33 +124,32 @@ _stack_end = 0x203FFC;
/* now define the output sections */ /* now define the output sections */
SECTIONS SECTIONS
{ {
. = 0; /* set location counter to address zero */ . = 0; /* set location counter to address zero */
.text : /* collect all sections that should go into FLASH after startup */ .text : /* collect all sections that should go into FLASH after startup */
{ {
*(.text*) /* all .text sections (code) */ *(.text*) /* all .text sections (code) */
*(.rodata) /* all .rodata sections (constants, strings, etc.) */ *(.rodata) /* all .rodata sections (constants, strings, etc.) */
*(.rodata*) /* all .rodata* sections (constants, strings, etc.) */ *(.rodata*) /* all .rodata* sections (constants, strings, etc.) */
*(.glue_7) /* all .glue_7 sections (no idea what these are) */ *(.glue_7) /* all .glue_7 sections (no idea what these are) */
*(.glue_7t) /* all .glue_7t sections (no idea what these are) */ *(.glue_7t) /* all .glue_7t sections (no idea what these are) */
_etext = .; /* define a global symbol _etext just after the last code byte */ _etext = .; /* define a global symbol _etext just after the last code byte */
} >flash /* put all the above into FLASH */ } >flash /* put all the above into FLASH */
.data : /* collect all initialized .data sections that go into RAM */ .data : /* collect all initialized .data sections that go into RAM */
{ {
_data = .; /* create a global symbol marking the start of the .data section */ _data = .; /* create a global symbol marking the start of the .data section */
*(.data*) /* all .data sections */ *(.data*) /* all .data sections */
_edata = .; /* define a global symbol marking the end of the .data section */ _edata = .; /* define a global symbol marking the end of the .data section */
} >ram AT >flash /* put all the above into RAM (but load the LMA initializer copy into FLASH) */ } >ram AT >flash /* put all the above into RAM (but load the LMA initializer copy into FLASH) */
.bss : /* collect all uninitialized .bss sections that go into RAM */ .bss : /* collect all uninitialized .bss sections that go into RAM */
{ {
_bss_start = .; /* define a global symbol marking the start of the .bss section */ _bss_start = .; /* define a global symbol marking the start of the .bss section */
*(.bss*) /* all .bss sections */ *(.bss*) /* all .bss sections */
} >ram /* put all the above in RAM (it will be cleared in the startup code */ } >ram /* put all the above in RAM (it will be cleared in the startup code */
. = ALIGN(4); /* advance location counter to the next 32-bit boundary */ . = ALIGN(4); /* advance location counter to the next 32-bit boundary */
_bss_end = . ; /* define a global symbol marking the end of the .bss section */ _bss_end = . ; /* define a global symbol marking the end of the .bss section */
} }
_end = .; /* define a global symbol marking the end of application RAM */ _end = .; /* define a global symbol marking the end of application RAM */
+2 -2
View File
@@ -78,7 +78,7 @@
</option> </option>
<option> <option>
<name>OGChipSelectEditMenu</name> <name>OGChipSelectEditMenu</name>
<state>AT91SAM7S256 Atmel AT91SAM7S256</state> <state>AT91SAM7S256 Atmel AT91SAM7S256</state>
</option> </option>
<option> <option>
<name>GenLowLevelInterface</name> <name>GenLowLevelInterface</name>
@@ -138,7 +138,7 @@
</option> </option>
<option> <option>
<name>GFPUDeviceSlave</name> <name>GFPUDeviceSlave</name>
<state>AT91SAM7S256 Atmel AT91SAM7S256</state> <state>AT91SAM7S256 Atmel AT91SAM7S256</state>
</option> </option>
<option> <option>
<name>FPU2</name> <name>FPU2</name>
-2
View File
@@ -6,5 +6,3 @@
</project> </project>
<batchBuild/> <batchBuild/>
</workspace> </workspace>
+31 -31
View File
@@ -24,57 +24,57 @@
/*----------------------------------------------- */ /*----------------------------------------------- */
/* The AT91SAM7S2564 embeds a 64-Kbyte SRAM bank, and 256 K-Byte Flash */ /* The AT91SAM7S2564 embeds a 64-Kbyte SRAM bank, and 256 K-Byte Flash */
#define INT_SRAM 0x00200000 #define INT_SRAM 0x00200000
#define INT_SRAM_REMAP 0x00000000 #define INT_SRAM_REMAP 0x00000000
#define INT_FLASH 0x00000000 #define INT_FLASH 0x00000000
#define INT_FLASH_REMAP 0x01000000 #define INT_FLASH_REMAP 0x01000000
#define FLASH_PAGE_NB 512 #define FLASH_PAGE_NB 512
#define FLASH_PAGE_SIZE 128 #define FLASH_PAGE_SIZE 128
/*------------------------ */ /*------------------------ */
/* Leds Definition */ /* Leds Definition */
/*------------------------ */ /*------------------------ */
#define LED1 (1<<0) /* PA0 */ #define LED1 (1<<0) /* PA0 */
#define LED2 (1<<1) /* PA1 */ #define LED2 (1<<1) /* PA1 */
#define LED3 (1<<2) /* PA2 */ #define LED3 (1<<2) /* PA2 */
#define LED4 (1<<3) /* PA3 */ #define LED4 (1<<3) /* PA3 */
#define NB_LEB 4 #define NB_LEB 4
#define LED_MASK (LED1|LED2|LED3|LED4) #define LED_MASK (LED1|LED2|LED3|LED4)
/*---------------------------------- */ /*---------------------------------- */
/* Push Buttons Definition */ /* Push Buttons Definition */
/*----------------------------------- */ /*----------------------------------- */
#define SW1_MASK (1<<19) /* PA19 */ #define SW1_MASK (1<<19) /* PA19 */
#define SW2_MASK (1<<20) /* PA20 */ #define SW2_MASK (1<<20) /* PA20 */
#define SW3_MASK (1<<15) /* PA15 */ #define SW3_MASK (1<<15) /* PA15 */
#define SW4_MASK (1<<14) /* PA14 */ #define SW4_MASK (1<<14) /* PA14 */
#define SW_MASK (SW1_MASK|SW2_MASK|SW3_MASK|SW4_MASK) #define SW_MASK (SW1_MASK|SW2_MASK|SW3_MASK|SW4_MASK)
#define SW1 (1<<19) /* PA19 */ #define SW1 (1<<19) /* PA19 */
#define SW2 (1<<20) /* PA20 */ #define SW2 (1<<20) /* PA20 */
#define SW3 (1<<15) /* PA15 */ #define SW3 (1<<15) /* PA15 */
#define SW4 (1<<14) /* PA14 */ #define SW4 (1<<14) /* PA14 */
/*------------------------- */ /*------------------------- */
/* USART Definition */ /* USART Definition */
/*------------------------- */ /*------------------------- */
/* SUB-D 9 points J3 DBGU */ /* SUB-D 9 points J3 DBGU */
#define DBGU_RXD AT91C_PA9_DRXD /* JP11 must be close */ #define DBGU_RXD AT91C_PA9_DRXD /* JP11 must be close */
#define DBGU_TXD AT91C_PA10_DTXD /* JP12 must be close */ #define DBGU_TXD AT91C_PA10_DTXD /* JP12 must be close */
#define AT91C_DBGU_BAUD 115200 /* Baud rate */ #define AT91C_DBGU_BAUD 115200 /* Baud rate */
#define US_RXD_PIN AT91C_PA5_RXD0 /* JP9 must be close */ #define US_RXD_PIN AT91C_PA5_RXD0 /* JP9 must be close */
#define US_TXD_PIN AT91C_PA6_TXD0 /* JP7 must be close */ #define US_TXD_PIN AT91C_PA6_TXD0 /* JP7 must be close */
#define US_RTS_PIN AT91C_PA7_RTS0 /* JP8 must be close */ #define US_RTS_PIN AT91C_PA7_RTS0 /* JP8 must be close */
#define US_CTS_PIN AT91C_PA8_CTS0 /* JP6 must be close */ #define US_CTS_PIN AT91C_PA8_CTS0 /* JP6 must be close */
/*-------------- */ /*-------------- */
/* Master Clock */ /* Master Clock */
/*-------------- */ /*-------------- */
#define EXT_OC 18432000 /* Exetrnal ocilator MAINCK */ #define EXT_OC 18432000 /* Exetrnal ocilator MAINCK */
#define MCK 47923200 /* MCK (PLLRC div by 2) */ #define MCK 47923200 /* MCK (PLLRC div by 2) */
#define MCKKHz (MCK/1000) /* */ #define MCKKHz (MCK/1000) /* */
#endif /* Board_h */ #endif /* Board_h */
+179 -179
View File
@@ -1,40 +1,40 @@
/* ****************************************************************************************************** */ /* ****************************************************************************************************** */
/* crt.s */ /* crt.s */
/* */ /* */
/* Assembly Language Startup Code for Atmel AT91SAM7S256 */ /* Assembly Language Startup Code for Atmel AT91SAM7S256 */
/* */ /* */
/* */ /* */
/* */ /* */
/* */ /* */
/* Author: James P Lynch May 12, 2007 */ /* Author: James P Lynch May 12, 2007 */
/* ****************************************************************************************************** */ /* ****************************************************************************************************** */
/* Stack Sizes */ /* Stack Sizes */
.set UND_STACK_SIZE, 0x00000010 /* stack for "undefined instruction" interrupts is 16 bytes */ .set UND_STACK_SIZE, 0x00000010 /* stack for "undefined instruction" interrupts is 16 bytes */
.set ABT_STACK_SIZE, 0x00000010 /* stack for "abort" interrupts is 16 bytes */ .set ABT_STACK_SIZE, 0x00000010 /* stack for "abort" interrupts is 16 bytes */
.set FIQ_STACK_SIZE, 0x00000080 /* stack for "FIQ" interrupts is 128 bytes */ .set FIQ_STACK_SIZE, 0x00000080 /* stack for "FIQ" interrupts is 128 bytes */
.set IRQ_STACK_SIZE, 0X00000080 /* stack for "IRQ" normal interrupts is 128 bytes */ .set IRQ_STACK_SIZE, 0X00000080 /* stack for "IRQ" normal interrupts is 128 bytes */
.set SVC_STACK_SIZE, 0x00000080 /* stack for "SVC" supervisor mode is 128 bytes */ .set SVC_STACK_SIZE, 0x00000080 /* stack for "SVC" supervisor mode is 128 bytes */
/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs (program status registers) */ /* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs (program status registers) */
.set ARM_MODE_USR, 0x10 /* Normal User Mode */ .set ARM_MODE_USR, 0x10 /* Normal User Mode */
.set ARM_MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */ .set ARM_MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */
.set ARM_MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */ .set ARM_MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */
.set ARM_MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */ .set ARM_MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */
.set ARM_MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */ .set ARM_MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */
.set ARM_MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode */ .set ARM_MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode */
.set ARM_MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks Mode */ .set ARM_MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks Mode */
.set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status registers) */ .set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status registers) */
.set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status registers) */ .set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status registers) */
/* Addresses and offsets of AIC and PIO */ /* Addresses and offsets of AIC and PIO */
.set AT91C_BASE_AIC, 0xFFFFF000 /* (AIC) Base Address */ .set AT91C_BASE_AIC, 0xFFFFF000 /* (AIC) Base Address */
.set AT91C_PIOA_CODR, 0xFFFFF434 /* (PIO) Clear Output Data Register */ .set AT91C_PIOA_CODR, 0xFFFFF434 /* (PIO) Clear Output Data Register */
.set AT91C_AIC_IVR, 0xFFFFF100 /* (AIC) IRQ Interrupt Vector Register */ .set AT91C_AIC_IVR, 0xFFFFF100 /* (AIC) IRQ Interrupt Vector Register */
.set AT91C_AIC_FVR, 0xFFFFF104 /* (AIC) FIQ Interrupt Vector Register */ .set AT91C_AIC_FVR, 0xFFFFF104 /* (AIC) FIQ Interrupt Vector Register */
.set AIC_IVR, 256 /* IRQ Vector Register offset from base above */ .set AIC_IVR, 256 /* IRQ Vector Register offset from base above */
.set AIC_FVR, 260 /* FIQ Vector Register offset from base above */ .set AIC_FVR, 260 /* FIQ Vector Register offset from base above */
.set AIC_EOICR, 304 /* End of Interrupt Command Register */ .set AIC_EOICR, 304 /* End of Interrupt Command Register */
/* identify all GLOBAL symbols */ /* identify all GLOBAL symbols */
.global _vec_reset .global _vec_reset
@@ -46,165 +46,165 @@
.global _vec_irq .global _vec_irq
.global _vec_fiq .global _vec_fiq
.global AT91F_Irq_Handler .global AT91F_Irq_Handler
.global AT91F_Fiq_Handler .global AT91F_Fiq_Handler
.global AT91F_Default_FIQ_handler .global AT91F_Default_FIQ_handler
.global AT91F_Default_IRQ_handler .global AT91F_Default_IRQ_handler
.global AT91F_Spurious_handler .global AT91F_Spurious_handler
.global AT91F_Dabt_Handler .global AT91F_Dabt_Handler
.global AT91F_Pabt_Handler .global AT91F_Pabt_Handler
.global AT91F_Undef_Handler .global AT91F_Undef_Handler
/* GNU assembler controls */ /* GNU assembler controls */
.text /* all assembler code that follows will go into .text section */ .text /* all assembler code that follows will go into .text section */
.arm /* compile for 32-bit ARM instruction set */ .arm /* compile for 32-bit ARM instruction set */
.align /* align section on 32-bit boundary */ .align /* align section on 32-bit boundary */
/* ============================================================ */ /* ============================================================ */
/* VECTOR TABLE */ /* VECTOR TABLE */
/* */ /* */
/* Must be located in FLASH at address 0x00000000 */ /* Must be located in FLASH at address 0x00000000 */
/* */ /* */
/* Easy to do if this file crt.s is first in the list */ /* Easy to do if this file crt.s is first in the list */
/* for the linker step in the makefile, e.g. */ /* for the linker step in the makefile, e.g. */
/* */ /* */
/* $(LD) $(LFLAGS) -o main.out crt.o main.o */ /* $(LD) $(LFLAGS) -o main.out crt.o main.o */
/* */ /* */
/* ============================================================ */ /* ============================================================ */
_vec_reset: b _init_reset /* RESET vector - must be at 0x00000000 */ _vec_reset: b _init_reset /* RESET vector - must be at 0x00000000 */
_vec_undef: b AT91F_Undef_Handler /* Undefined Instruction vector */ _vec_undef: b AT91F_Undef_Handler /* Undefined Instruction vector */
_vec_swi: b _vec_swi /* Software Interrupt vector */ _vec_swi: b _vec_swi /* Software Interrupt vector */
_vec_pabt: b AT91F_Pabt_Handler /* Prefetch abort vector */ _vec_pabt: b AT91F_Pabt_Handler /* Prefetch abort vector */
_vec_dabt: b AT91F_Dabt_Handler /* Data abort vector */ _vec_dabt: b AT91F_Dabt_Handler /* Data abort vector */
_vec_rsv: nop /* Reserved vector */ _vec_rsv: nop /* Reserved vector */
_vec_irq: b AT91F_Irq_Handler /* Interrupt Request (IRQ) vector */ _vec_irq: b AT91F_Irq_Handler /* Interrupt Request (IRQ) vector */
_vec_fiq: /* Fast interrupt request (FIQ) vector */ _vec_fiq: /* Fast interrupt request (FIQ) vector */
/* ======================================================================== */ /* ======================================================================== */
/* Function: AT91F_Fiq_Handler */ /* Function: AT91F_Fiq_Handler */
/* */ /* */
/* The FIQ interrupt asserts when switch SW1 is pressed. */ /* The FIQ interrupt asserts when switch SW1 is pressed. */
/* */ /* */
/* This simple FIQ handler turns on LED3 (Port PA2). The LED3 will be */ /* This simple FIQ handler turns on LED3 (Port PA2). The LED3 will be */
/* turned off by the background loop in main() thus giving a visual */ /* turned off by the background loop in main() thus giving a visual */
/* indication that the interrupt has occurred. */ /* indication that the interrupt has occurred. */
/* */ /* */
/* This FIQ_Handler supports non-nested FIQ interrupts (a FIQ interrupt */ /* This FIQ_Handler supports non-nested FIQ interrupts (a FIQ interrupt */
/* cannot itself be interrupted). */ /* cannot itself be interrupted). */
/* */ /* */
/* The Fast Interrupt Vector Register (AIC_FVR) is read to clear the */ /* The Fast Interrupt Vector Register (AIC_FVR) is read to clear the */
/* interrupt. */ /* interrupt. */
/* */ /* */
/* A global variable FiqCount is also incremented. */ /* A global variable FiqCount is also incremented. */
/* */ /* */
/* Remember that switch SW1 is not debounced, so the FIQ interrupt may */ /* Remember that switch SW1 is not debounced, so the FIQ interrupt may */
/* occur more than once for a single button push. */ /* occur more than once for a single button push. */
/* */ /* */
/* Programmer: James P Lynch */ /* Programmer: James P Lynch */
/* ======================================================================== */ /* ======================================================================== */
AT91F_Fiq_Handler: AT91F_Fiq_Handler:
/* Adjust LR_irq */ /* Adjust LR_irq */
sub lr, lr, #4 sub lr, lr, #4
/* Read the AIC Fast Interrupt Vector register to clear the interrupt */ /* Read the AIC Fast Interrupt Vector register to clear the interrupt */
ldr r12, =AT91C_AIC_FVR ldr r12, =AT91C_AIC_FVR
ldr r11, [r12] ldr r11, [r12]
/* Return from Fiq interrupt */ /* Return from Fiq interrupt */
movs pc, lr movs pc, lr
/* ======================================================================== */ /* ======================================================================== */
/* _init_reset Handler */ /* _init_reset Handler */
/* */ /* */
/* RESET vector 0x00000000 branches to here. */ /* RESET vector 0x00000000 branches to here. */
/* */ /* */
/* ARM microprocessor begins execution after RESET at address 0x00000000 */ /* ARM microprocessor begins execution after RESET at address 0x00000000 */
/* in Supervisor mode with interrupts disabled! */ /* in Supervisor mode with interrupts disabled! */
/* */ /* */
/* _init_reset handler: creates a stack for each ARM mode. */ /* _init_reset handler: creates a stack for each ARM mode. */
/* sets up a stack pointer for each ARM mode. */ /* sets up a stack pointer for each ARM mode. */
/* turns off interrupts in each mode. */ /* turns off interrupts in each mode. */
/* leaves CPU in SYS (System) mode. */ /* leaves CPU in SYS (System) mode. */
/* */ /* */
/* block copies the initializers to .data section */ /* block copies the initializers to .data section */
/* clears the .bss section to zero */ /* clears the .bss section to zero */
/* */ /* */
/* branches to main( ) */ /* branches to main( ) */
/* ======================================================================== */ /* ======================================================================== */
.text /* all assembler code that follows will go into .text section */ .text /* all assembler code that follows will go into .text section */
.align /* align section on 32-bit boundary */ .align /* align section on 32-bit boundary */
_init_reset: _init_reset:
/* Setup a stack for each mode with interrupts initially disabled. */ /* Setup a stack for each mode with interrupts initially disabled. */
ldr r0, =_stack_end /* r0 = top-of-stack */ ldr r0, =_stack_end /* r0 = top-of-stack */
msr CPSR_c, #ARM_MODE_UND|I_BIT|F_BIT /* switch to Undefined Instruction Mode */ msr CPSR_c, #ARM_MODE_UND|I_BIT|F_BIT /* switch to Undefined Instruction Mode */
mov sp, r0 /* set stack pointer for UND mode */ mov sp, r0 /* set stack pointer for UND mode */
sub r0, r0, #UND_STACK_SIZE /* adjust r0 past UND stack */ sub r0, r0, #UND_STACK_SIZE /* adjust r0 past UND stack */
msr CPSR_c, #ARM_MODE_ABT|I_BIT|F_BIT /* switch to Abort Mode */ msr CPSR_c, #ARM_MODE_ABT|I_BIT|F_BIT /* switch to Abort Mode */
mov sp, r0 /* set stack pointer for ABT mode */ mov sp, r0 /* set stack pointer for ABT mode */
sub r0, r0, #ABT_STACK_SIZE /* adjust r0 past ABT stack */ sub r0, r0, #ABT_STACK_SIZE /* adjust r0 past ABT stack */
msr CPSR_c, #ARM_MODE_FIQ|I_BIT|F_BIT /* switch to FIQ Mode */ msr CPSR_c, #ARM_MODE_FIQ|I_BIT|F_BIT /* switch to FIQ Mode */
mov sp, r0 /* set stack pointer for FIQ mode */ mov sp, r0 /* set stack pointer for FIQ mode */
sub r0, r0, #FIQ_STACK_SIZE /* adjust r0 past FIQ stack */ sub r0, r0, #FIQ_STACK_SIZE /* adjust r0 past FIQ stack */
msr CPSR_c, #ARM_MODE_IRQ|I_BIT|F_BIT /* switch to IRQ Mode */ msr CPSR_c, #ARM_MODE_IRQ|I_BIT|F_BIT /* switch to IRQ Mode */
mov sp, r0 /* set stack pointer for IRQ mode */ mov sp, r0 /* set stack pointer for IRQ mode */
sub r0, r0, #IRQ_STACK_SIZE /* adjust r0 past IRQ stack */ sub r0, r0, #IRQ_STACK_SIZE /* adjust r0 past IRQ stack */
msr CPSR_c, #ARM_MODE_SVC|I_BIT|F_BIT /* switch to Supervisor Mode */ msr CPSR_c, #ARM_MODE_SVC|I_BIT|F_BIT /* switch to Supervisor Mode */
mov sp, r0 /* set stack pointer for SVC mode */ mov sp, r0 /* set stack pointer for SVC mode */
sub r0, r0, #SVC_STACK_SIZE /* adjust r0 past SVC stack */ sub r0, r0, #SVC_STACK_SIZE /* adjust r0 past SVC stack */
msr CPSR_c, #ARM_MODE_SYS|I_BIT|F_BIT /* switch to System Mode */ msr CPSR_c, #ARM_MODE_SYS|I_BIT|F_BIT /* switch to System Mode */
mov sp, r0 /* set stack pointer for SYS mode */ mov sp, r0 /* set stack pointer for SYS mode */
/* we now start execution in SYSTEM mode */ /* we now start execution in SYSTEM mode */
/* This is exactly like USER mode (same stack) */ /* This is exactly like USER mode (same stack) */
/* but SYSTEM mode has more privileges */ /* but SYSTEM mode has more privileges */
/* copy initialized variables .data section (Copy from ROM to RAM) */ /* copy initialized variables .data section (Copy from ROM to RAM) */
ldr R1, =_etext ldr R1, =_etext
ldr R2, =_data ldr R2, =_data
ldr R3, =_edata ldr R3, =_edata
1: cmp R2, R3 1: cmp R2, R3
ldrlo R0, [R1], #4 ldrlo R0, [R1], #4
strlo R0, [R2], #4 strlo R0, [R2], #4
blo 1b blo 1b
/* Clear uninitialized variables .bss section (Zero init) */ /* Clear uninitialized variables .bss section (Zero init) */
mov R0, #0 mov R0, #0
ldr R1, =_bss_start ldr R1, =_bss_start
ldr R2, =_bss_end ldr R2, =_bss_end
2: cmp R1, R2 2: cmp R1, R2
strlo R0, [R1], #4 strlo R0, [R1], #4
blo 2b blo 2b
/* Enter the C code */ /* Enter the C code */
b main b main
/* ======================================================================== */ /* ======================================================================== */
/* Function: AT91F_Irq_Handler */ /* Function: AT91F_Irq_Handler */
/* */ /* */
/* This IRQ_Handler supports nested interrupts (an IRQ interrupt can itself */ /* This IRQ_Handler supports nested interrupts (an IRQ interrupt can itself */
/* be interrupted). */ /* be interrupted). */
/* */ /* */
/* This handler re-enables interrupts and switches to "Supervisor" mode to */ /* This handler re-enables interrupts and switches to "Supervisor" mode to */
/* prevent any corruption to the link and IP registers. */ /* prevent any corruption to the link and IP registers. */
/* */ /* */
/* The Interrupt Vector Register (AIC_IVR) is read to determine the address */ /* The Interrupt Vector Register (AIC_IVR) is read to determine the address */
/* of the required interrupt service routine. The ISR routine can be a */ /* of the required interrupt service routine. The ISR routine can be a */
/* standard C function since this handler minds all the save/restore */ /* standard C function since this handler minds all the save/restore */
/* protocols. */ /* protocols. */
/* */ /* */
/* */ /* */
/* Programmers: */ /* Programmers: */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* ATMEL Microcontroller Software Support - ROUSSET - */ /* ATMEL Microcontroller Software Support - ROUSSET - */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -223,97 +223,97 @@ _init_reset:
/* Object : Generic CStartup to AT91SAM7S256 */ /* Object : Generic CStartup to AT91SAM7S256 */
/* 1.0 09/May/06 JPP : Creation */ /* 1.0 09/May/06 JPP : Creation */
/* */ /* */
/* */ /* */
/* Note: taken from Atmel web site (www.at91.com) */ /* Note: taken from Atmel web site (www.at91.com) */
/* Keil example project: AT91SAM7S-Interrupt_SAM7S */ /* Keil example project: AT91SAM7S-Interrupt_SAM7S */
/* ======================================================================== */ /* ======================================================================== */
AT91F_Irq_Handler: AT91F_Irq_Handler:
/* Manage Exception Entry */ /* Manage Exception Entry */
/* Adjust and save LR_irq in IRQ stack */ /* Adjust and save LR_irq in IRQ stack */
sub lr, lr, #4 sub lr, lr, #4
stmfd sp!, {lr} stmfd sp!, {lr}
/* Save r0 and SPSR (need to be saved for nested interrupt) */ /* Save r0 and SPSR (need to be saved for nested interrupt) */
mrs r14, SPSR mrs r14, SPSR
stmfd sp!, {r0,r14} stmfd sp!, {r0,r14}
/* Write in the IVR to support Protect Mode */ /* Write in the IVR to support Protect Mode */
/* No effect in Normal Mode */ /* No effect in Normal Mode */
/* De-assert the NIRQ and clear the source in Protect Mode */ /* De-assert the NIRQ and clear the source in Protect Mode */
ldr r14, =AT91C_BASE_AIC ldr r14, =AT91C_BASE_AIC
ldr r0 , [r14, #AIC_IVR] ldr r0 , [r14, #AIC_IVR]
str r14, [r14, #AIC_IVR] str r14, [r14, #AIC_IVR]
/* Enable Interrupt and Switch in Supervisor Mode */ /* Enable Interrupt and Switch in Supervisor Mode */
msr CPSR_c, #ARM_MODE_SVC msr CPSR_c, #ARM_MODE_SVC
/* Save scratch/used registers and LR in User Stack */ /* Save scratch/used registers and LR in User Stack */
stmfd sp!, { r1-r3, r12, r14} stmfd sp!, { r1-r3, r12, r14}
/* Branch to the routine pointed by the AIC_IVR */ /* Branch to the routine pointed by the AIC_IVR */
mov r14, pc mov r14, pc
bx r0 bx r0
/* Manage Exception Exit */ /* Manage Exception Exit */
/* Restore scratch/used registers and LR from User Stack */ /* Restore scratch/used registers and LR from User Stack */
ldmia sp!, { r1-r3, r12, r14} ldmia sp!, { r1-r3, r12, r14}
/* Disable Interrupt and switch back in IRQ mode */ /* Disable Interrupt and switch back in IRQ mode */
msr CPSR_c, #I_BIT | ARM_MODE_IRQ msr CPSR_c, #I_BIT | ARM_MODE_IRQ
/* Mark the End of Interrupt on the AIC */ /* Mark the End of Interrupt on the AIC */
ldr r14, =AT91C_BASE_AIC ldr r14, =AT91C_BASE_AIC
str r14, [r14, #AIC_EOICR] str r14, [r14, #AIC_EOICR]
/* Restore SPSR_irq and r0 from IRQ stack */ /* Restore SPSR_irq and r0 from IRQ stack */
ldmia sp!, {r0,r14} ldmia sp!, {r0,r14}
msr SPSR_cxsf, r14 msr SPSR_cxsf, r14
/* Restore adjusted LR_irq from IRQ stack directly in the PC */ /* Restore adjusted LR_irq from IRQ stack directly in the PC */
ldmia sp!, {pc}^ ldmia sp!, {pc}^
/* ======================================================================== */ /* ======================================================================== */
/* Function: AT91F_Dabt_Handler */ /* Function: AT91F_Dabt_Handler */
/* */ /* */
/* Entered on Data Abort exception. */ /* Entered on Data Abort exception. */
/* Enters blink routine (3 blinks followed by a pause) */ /* Enters blink routine (3 blinks followed by a pause) */
/* processor hangs in the blink loop forever */ /* processor hangs in the blink loop forever */
/* */ /* */
/* ======================================================================== */ /* ======================================================================== */
AT91F_Dabt_Handler: mov R0, #3 AT91F_Dabt_Handler: mov R0, #3
b blinker b blinker
/* ======================================================================== */ /* ======================================================================== */
/* Function: AT91F_Pabt_Handler */ /* Function: AT91F_Pabt_Handler */
/* */ /* */
/* Entered on Prefetch Abort exception. */ /* Entered on Prefetch Abort exception. */
/* Enters blink routine (2 blinks followed by a pause) */ /* Enters blink routine (2 blinks followed by a pause) */
/* processor hangs in the blink loop forever */ /* processor hangs in the blink loop forever */
/* */ /* */
/* ======================================================================== */ /* ======================================================================== */
AT91F_Pabt_Handler: mov R0, #2 AT91F_Pabt_Handler: mov R0, #2
b blinker b blinker
/* ======================================================================== */ /* ======================================================================== */
/* Function: AT91F_Undef_Handler */ /* Function: AT91F_Undef_Handler */
/* */ /* */
/* Entered on Undefined Instruction exception. */ /* Entered on Undefined Instruction exception. */
/* Enters blink routine (1 blinks followed by a pause) */ /* Enters blink routine (1 blinks followed by a pause) */
/* processor hangs in the blink loop forever */ /* processor hangs in the blink loop forever */
/* */ /* */
/* ======================================================================== */ /* ======================================================================== */
AT91F_Undef_Handler: mov R0, #1 AT91F_Undef_Handler: mov R0, #1
b blinker b blinker
AT91F_Default_FIQ_handler: b AT91F_Default_FIQ_handler AT91F_Default_FIQ_handler: b AT91F_Default_FIQ_handler
AT91F_Default_IRQ_handler: b AT91F_Default_IRQ_handler AT91F_Default_IRQ_handler: b AT91F_Default_IRQ_handler
AT91F_Spurious_handler: b AT91F_Spurious_handler AT91F_Spurious_handler: b AT91F_Spurious_handler
.end .end
+2 -2
View File
@@ -372,8 +372,8 @@ static int Network_Port_Link_Speeds_Encode(
/** /**
* @brief Set the device link speed (baud rate) * @brief Set the device link speed (baud rate)
* @param object_instance The object instance number of the object * @param object_instance The object instance number of the object
* @param value The new link speed value * @param value The new link speed value
* @return true if value was set * @return true if value was set
*/ */
bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value) bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value)
+3 -3
View File
@@ -216,7 +216,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m328 ATmega328</state> <state>m328 ATmega328</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
@@ -1279,7 +1279,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m168 ATmega168</state> <state>m168 ATmega168</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
@@ -2341,7 +2341,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m328 ATmega328</state> <state>m328 ATmega328</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
-2
View File
@@ -6,5 +6,3 @@
</project> </project>
<batchBuild/> <batchBuild/>
</workspace> </workspace>
+4 -4
View File
@@ -216,7 +216,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m644p ATmega644P</state> <state>m644p ATmega644P</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
@@ -1282,7 +1282,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m1284p ATmega1284P</state> <state>m1284p ATmega1284P</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
@@ -2348,7 +2348,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m644p ATmega644P</state> <state>m644p ATmega644P</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
@@ -3414,7 +3414,7 @@
</option> </option>
<option> <option>
<name>GenDeviceSelectMenu</name> <name>GenDeviceSelectMenu</name>
<state>m1284p ATmega1284P</state> <state>m1284p ATmega1284P</state>
</option> </option>
<option> <option>
<name>OGProductVersion</name> <name>OGProductVersion</name>
-2
View File
@@ -6,5 +6,3 @@
</project> </project>
<batchBuild/> <batchBuild/>
</workspace> </workspace>
+2 -2
View File
@@ -373,8 +373,8 @@ static int Network_Port_Link_Speeds_Encode(
/** /**
* @brief Set the device link speed (baud rate) * @brief Set the device link speed (baud rate)
* @param object_instance The object instance number of the object * @param object_instance The object instance number of the object
* @param value The new link speed value * @param value The new link speed value
* @return true if value was set * @return true if value was set
*/ */
bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value) bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value)
+48 -48
View File
@@ -1,6 +1,6 @@
Bacnet Server for Espressif ESP32 Bacnet Server for Espressif ESP32
Steve Karg Bacnet stack using PlatformIO open source ecosystem for IoT development on VSCode or Atom Steve Karg Bacnet stack using PlatformIO open source ecosystem for IoT development on VSCode or Atom
F. Chaxel 2017 F. Chaxel 2017
TODO list : TODO list :
@@ -13,55 +13,55 @@ Goto lib/stack and copy the requested files from Steve code :
all .h from include directory (not all required by it's simple) all .h from include directory (not all required by it's simple)
these .c files from src or demo/handlers these .c files from src or demo/handlers
abort.c abort.c
address.c address.c
apdu.c apdu.c
bacaddr.c bacaddr.c
bacapp.c bacapp.c
bacdcode.c bacdcode.c
bacerror.c bacerror.c
bacint.c bacint.c
bacreal.c bacreal.c
bacstr.c bacstr.c
bip.c bip.c
bvlc.c bvlc.c
cov.c cov.c
datetime.c datetime.c
bacdevobjpropref.c bacdevobjpropref.c
dcc.c dcc.c
debug.c debug.c
h_cov.c h_cov.c
h_ucov.c h_ucov.c
h_npdu.c h_npdu.c
h_rp.c h_rp.c
h_rpm.c h_rpm.c
h_whois.c h_whois.c
h_wp.c h_wp.c
iam.c iam.c
hostnport.c hostnport.c
lighting.c lighting.c
memcopy.c memcopy.c
noserv.c noserv.c
npdu.c npdu.c
proplist.c proplist.c
reject.c reject.c
rp.c rp.c
rpm.c rpm.c
s_iam.c s_iam.c
tsm.c tsm.c
whois.c whois.c
wp.c wp.c
Modify Modify
in config.h in config.h
MAX_TSM_TRANSACTIONS 255, set the value to 10 for instances MAX_TSM_TRANSACTIONS 255, set the value to 10 for instances
in main.c in main.c
wifi_config to fit your wifi network wifi_config to fit your wifi network
BACNET_LED 5, set another IO number depending of your board BACNET_LED 5, set another IO number depending of your board
A lot of Warning will be issued at compile time due to the redefinition of BIT macros. A lot of Warning will be issued at compile time due to the redefinition of BIT macros.
Could be removes by placing a #ifndef #BIT0 .. #endif arround the BIT macro in bits.h, Could be removes by placing a #ifndef #BIT0 .. #endif arround the BIT macro in bits.h,
and moving to the top of include list and moving to the top of include list
#include "bacnet/datalink/datalink.h" in tsm.c, s_iam and in device.c #include "bacnet/datalink/datalink.h" in tsm.c, s_iam and in device.c
#include "bacport.h" in bip.c and in bip.h (redondant include in bip.c) #include "bacport.h" in bip.c and in bip.h (redondant include in bip.c)
#include "bacnet/datalink/bvlc.h" in bvlc.c #include "bacnet/datalink/bvlc.h" in bvlc.c
+1 -1
View File
@@ -323,7 +323,7 @@ void Analog_Input_Out_Of_Service_Set(uint32_t object_instance, bool value)
index = Analog_Input_Instance_To_Index(object_instance); index = Analog_Input_Instance_To_Index(object_instance);
if (index < MAX_ANALOG_INPUTS) { if (index < MAX_ANALOG_INPUTS) {
/* BACnet Testing Observed Incident oi00104 /* BACnet Testing Observed Incident oi00104
The Changed flag was not being set when a client wrote to the The Changed flag was not being set when a client wrote to the
Out-of-Service bit. Revealed by BACnet Test Client v1.8.16 ( Out-of-Service bit. Revealed by BACnet Test Client v1.8.16 (
www.bac-test.com/bacnet-test-client-download ) BC 135.1: 8.2.1-A BC www.bac-test.com/bacnet-test-client-download ) BC 135.1: 8.2.1-A BC
+12 -12
View File
@@ -56,7 +56,7 @@ do
[0x82]="B/IPv6 (Annex X)" [0x82]="B/IPv6 (Annex X)"
} }
local t_BACnetBIPV6_Functions = { local t_BACnetBIPV6_Functions = {
-- Annex X, PPR3 Draft 22 -- Annex X, PPR3 Draft 22
[0x00]="BVLC-Result", [0x00]="BVLC-Result",
[0x01]="Original-Unicast-NPDU", [0x01]="Original-Unicast-NPDU",
[0x02]="Original-Broadcast-NPDU", [0x02]="Original-Broadcast-NPDU",
@@ -69,7 +69,7 @@ do
[0x09]="Register-Foreign-Device", [0x09]="Register-Foreign-Device",
[0x0A]="Delete-Foreign-Device", [0x0A]="Delete-Foreign-Device",
[0x0B]="Secure-BVLL", [0x0B]="Secure-BVLL",
[0x0C]="Distribute-Broadcast-To-Network" [0x0C]="Distribute-Broadcast-To-Network"
} }
local pf_BIPV6Data = ProtoField.bytes ("BIPV6.data", "B/IPV6 Data") local pf_BIPV6Data = ProtoField.bytes ("BIPV6.data", "B/IPV6 Data")
@@ -121,14 +121,14 @@ do
local ti_BIPV6 = {} local ti_BIPV6 = {}
ti_BIPV6.ti = tree:add(p_BACnetBIPV6,buffer(0)) ti_BIPV6.ti = tree:add(p_BACnetBIPV6,buffer(0))
offset, v_BIPV6.Type, ti_BIPV6.Type = uint_dissector(ti_BIPV6.ti, pf_BIPV6.Type, buffer, offset, 1) offset, v_BIPV6.Type, ti_BIPV6.Type = uint_dissector(ti_BIPV6.ti, pf_BIPV6.Type, buffer, offset, 1)
--if v_BIPV6.Type == 0x81 then --if v_BIPV6.Type == 0x81 then
-- p_dissector_bipv4:call(buffer, pkt, tree) -- p_dissector_bipv4:call(buffer, pkt, tree)
-- elseif v_BIPV6 ~= 0x82 then -- elseif v_BIPV6 ~= 0x82 then
-- ti_BIPV6.Type:add_expert_info(PI_MALFORMED, PI_WARN, "Unknown BVLC Type") -- ti_BIPV6.Type:add_expert_info(PI_MALFORMED, PI_WARN, "Unknown BVLC Type")
-- return -- return
--end --end
if v_BIPV6.Type ~= 0x82 then if v_BIPV6.Type ~= 0x82 then
ti_BIPV6.Type:add_expert_info(PI_MALFORMED, PI_WARN, "Unknown BVLC Type") ti_BIPV6.Type:add_expert_info(PI_MALFORMED, PI_WARN, "Unknown BVLC Type")
return return
end end
offset, v_BIPV6.Function, ti_BIPV6.Function = uint_dissector(ti_BIPV6.ti, pf_BIPV6.Function, buffer, offset, 1) offset, v_BIPV6.Function, ti_BIPV6.Function = uint_dissector(ti_BIPV6.ti, pf_BIPV6.Function, buffer, offset, 1)
@@ -148,7 +148,7 @@ do
p_dissector_bacnet:call(npduData:tvb(), pkt, tree) p_dissector_bacnet:call(npduData:tvb(), pkt, tree)
end end
end end
-- CLB don't show the raw data -- CLB don't show the raw data
-- if offset ~= buffer:len() then -- if offset ~= buffer:len() then
-- ti_BIPV6.ti:add(pf_BIPV6Data,buffer(offset)) -- ti_BIPV6.ti:add(pf_BIPV6Data,buffer(offset))
-- end -- end
@@ -187,7 +187,7 @@ do
t_BACnetBIPV6_dissectors[0x04] = function(buffer,pkt,tree,offset,npdu) t_BACnetBIPV6_dissectors[0x04] = function(buffer,pkt,tree,offset,npdu)
offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3) offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3)
offset = bytes_dissector(tree,pf_BIPV6.DestinationVirtualAddress,buffer,offset,3) offset = bytes_dissector(tree,pf_BIPV6.DestinationVirtualAddress,buffer,offset,3)
local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18)) local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18))
offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16) offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16)
offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2) offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2)
return offset return offset
@@ -215,7 +215,7 @@ do
-- [0x08] Forwarded-NPDU -- [0x08] Forwarded-NPDU
t_BACnetBIPV6_dissectors[0x08] = function(buffer,pkt,tree,offset,npdu) t_BACnetBIPV6_dissectors[0x08] = function(buffer,pkt,tree,offset,npdu)
offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3) offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3)
local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18)) local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18))
offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16) offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16)
offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2) offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2)
return offset, buffer(offset) return offset, buffer(offset)
@@ -243,7 +243,7 @@ do
-- [0x0C] Distribute-Broadcast-To-Network -- [0x0C] Distribute-Broadcast-To-Network
t_BACnetBIPV6_dissectors[0x0C] = function(buffer,pkt,tree,offset,npdu) t_BACnetBIPV6_dissectors[0x0C] = function(buffer,pkt,tree,offset,npdu)
offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3) offset = bytes_dissector(tree,pf_BIPV6.OriginalSourceVirtualAddress,buffer,offset,3)
local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18)) local subtree = tree:add(pf_BIPV6.OriginalSourceEffectiveAddress,buffer(offset,18))
offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16) offset = bytes_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_ip,buffer,offset,16)
offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2) offset = uint_dissector(subtree,pf_BIPV6.OriginalSourceEffectiveAddress_port,buffer,offset,2)
return offset, buffer(offset) return offset, buffer(offset)
+29 -29
View File
@@ -10,47 +10,47 @@
#define BACPORT_H #define BACPORT_H
/* common unix sockets headers needed */ /* common unix sockets headers needed */
#include <sys/types.h> /* basic system data types */ #include <sys/types.h> /* basic system data types */
#include <sys/time.h> /* timeval{} for select() */ #include <sys/time.h> /* timeval{} for select() */
#include <time.h> /* timespec{} for pselect() */ #include <time.h> /* timespec{} for pselect() */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */ #include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h> /* inet(3) functions */ #include <arpa/inet.h> /* inet(3) functions */
#include <fcntl.h> /* for nonblocking */ #include <fcntl.h> /* for nonblocking */
#include <netdb.h> #include <netdb.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> /* for S_xxx file mode constants */ #include <sys/stat.h> /* for S_xxx file mode constants */
#include <sys/uio.h> /* for iovec{} and readv/writev */ #include <sys/uio.h> /* for iovec{} and readv/writev */
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/un.h> /* for Unix domain sockets */ #include <sys/un.h> /* for Unix domain sockets */
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* for convenience */ #include <sys/select.h> /* for convenience */
#endif #endif
#ifdef HAVE_POLL_H #ifdef HAVE_POLL_H
#include <poll.h> /* for convenience */ #include <poll.h> /* for convenience */
#endif #endif
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
#include <strings.h> /* for convenience */ #include <strings.h> /* for convenience */
#endif #endif
/* Three headers are normally needed for socket/file ioctl's: /* Three headers are normally needed for socket/file ioctl's:
* <sys/ioctl.h>, <sys/filio.h>, and <sys/sockio.h>. * <sys/ioctl.h>, <sys/filio.h>, and <sys/sockio.h>.
*/ */
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#ifdef HAVE_SYS_FILIO_H #ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h> #include <sys/filio.h>
#endif #endif
#ifdef HAVE_SYS_SOCKIO_H #ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
#include <pthread.h> #include <pthread.h>
+1 -1
View File
@@ -118,7 +118,7 @@ static int timespec_subtract(
* *
* @param ts - The time to which to add to. * @param ts - The time to which to add to.
* @param ns - The number of nanoseconds to add. Allowed range * @param ns - The number of nanoseconds to add. Allowed range
* is -NS_PER_S..NS_PER_S (i.e., plus minus one second). * is -NS_PER_S..NS_PER_S (i.e., plus minus one second).
*/ */
static void timespec_add_ns(struct timespec *ts, long ns) static void timespec_add_ns(struct timespec *ts, long ns)
{ {
-1
View File
@@ -40,4 +40,3 @@ DATABANK NAME=stackreg START=0xC00 END=0xDFF PROTECTED
//STACK SIZE=0x100 RAM=gpr13 //STACK SIZE=0x100 RAM=gpr13
STACK SIZE=0x200 RAM=stackreg STACK SIZE=0x200 RAM=stackreg
-1
View File
@@ -40,4 +40,3 @@ DATABANK NAME=stackreg START=0xC00 END=0xDFF PROTECTED
//STACK SIZE=0x100 RAM=gpr13 //STACK SIZE=0x100 RAM=gpr13
STACK SIZE=0x200 RAM=stackreg STACK SIZE=0x200 RAM=stackreg
+1 -1
View File
@@ -781,7 +781,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
* If the Object or Property can't be found, sets the error class and code. * If the Object or Property can't be found, sets the error class and code.
* *
* @param rpdata [in,out] Structure with the desired Object and Property info * @param rpdata [in,out] Structure with the desired Object and Property info
* on entry, and APDU message on return. * on entry, and APDU message on return.
* @return The length of the APDU on success, else BACNET_STATUS_ERROR * @return The length of the APDU on success, else BACNET_STATUS_ERROR
*/ */
int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

+2 -2
View File
@@ -78,7 +78,7 @@
</option> </option>
<option> <option>
<name>OGChipSelectEditMenu</name> <name>OGChipSelectEditMenu</name>
<state>STM32F103ZG ST STM32F103ZG</state> <state>STM32F103ZG ST STM32F103ZG</state>
</option> </option>
<option> <option>
<name>GenLowLevelInterface</name> <name>GenLowLevelInterface</name>
@@ -138,7 +138,7 @@
</option> </option>
<option> <option>
<name>GFPUDeviceSlave</name> <name>GFPUDeviceSlave</name>
<state>STM32F103ZG ST STM32F103ZG</state> <state>STM32F103ZG ST STM32F103ZG</state>
</option> </option>
<option> <option>
<name>FPU2</name> <name>FPU2</name>
-2
View File
@@ -6,5 +6,3 @@
</project> </project>
<batchBuild/> <batchBuild/>
</workspace> </workspace>
+2 -2
View File
@@ -372,8 +372,8 @@ static int Network_Port_Link_Speeds_Encode(
/** /**
* @brief Set the device link speed (baud rate) * @brief Set the device link speed (baud rate)
* @param object_instance The object instance number of the object * @param object_instance The object instance number of the object
* @param value The new link speed value * @param value The new link speed value
* @return true if value was set * @return true if value was set
*/ */
bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value) bool Network_Port_Link_Speed_Set(uint32_t object_instance, float value)
+14 -14
View File
@@ -22,10 +22,10 @@ SECTIONS
*(.gnu.linkonce.r.*) *(.gnu.linkonce.r.*)
. = ALIGN(4); . = ALIGN(4);
_etext = .; _etext = .;
_sidata = _etext; _sidata = _etext;
PROVIDE(etext = .); PROVIDE(etext = .);
_fini = . ; _fini = . ;
*(.fini) *(.fini)
} >flash } >flash
@@ -40,20 +40,20 @@ SECTIONS
_edata = .; _edata = .;
} >sram } >sram
.ARM.extab : .ARM.extab :
{ {
*(.ARM.extab*) *(.ARM.extab*)
} >sram } >sram
__exidx_start = .; __exidx_start = .;
.ARM.exidx : .ARM.exidx :
{ {
*(.ARM.exidx*) *(.ARM.exidx*)
} >sram } >sram
__exidx_end = .; __exidx_end = .;
.bss (NOLOAD) : { .bss (NOLOAD) : {
. = ALIGN(4); . = ALIGN(4);
/* This is used by the startup in order to initialize the .bss secion */ /* This is used by the startup in order to initialize the .bss secion */
_sbss = .; _sbss = .;
*(.bss .bss.*) *(.bss .bss.*)
+1 -1
View File
@@ -397,7 +397,7 @@ static void SetSysClock(void)
/** /**
* @brief Setup the external memory controller. * @brief Setup the external memory controller.
* Called in startup_stm32f10x_xx.s/.c before jump to main. * Called in startup_stm32f10x_xx.s/.c before jump to main.
* This function configures the external SRAM mounted on * This function configures the external SRAM mounted on
* STM3210E-EVAL board (STM32 High density devices). This SRAM will be used as * STM3210E-EVAL board (STM32 High density devices). This SRAM will be used as
* program data memory (including heap and stack). * program data memory (including heap and stack).
* @param None * @param None

Some files were not shown because too many files have changed in this diff Show More