Files
bacnet_stack/ports/lwip
Kari Argillander cb243c36a8 Improve SPDX identifier coverage (#716)
* Change MIT license texts to SPDX-License-Identifier

SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.

* Change GPL exception license texts to SPDX-License-Identifier

SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.

* Change misc license texts to SPDX-License-Identifier

There are some external code in repo which are not licenses as most of
the stuff in this repo. We still want every file to have SPDX identifier
to easily grep licenses.

* Add currently used license files

Even though Bacnet-Stack is using SPDX identifiers we still need to give
those license files with source. For this reason add all license files
to license/ folder.

SPDX has also files which would make same thing but this is style which
example Linux kernel is using and it is quite clear so I choose that one
for now.

I choosed not yet bring CC-PDDC as that is not right license for those
files.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2024-08-12 15:33:02 -05:00
..
2024-08-12 15:33:02 -05:00
2024-08-12 15:33:02 -05:00

Port of BACnet/IP to LwIP 2.x

This LwIP BACnet/IP port uses a Makefile designed to be used from the continuous integration pipeline. The container is configured with Ubuntu Linux and uses APT to install liblwip-dev library and header files. This build method ensures that the code is valid for the particular LwIP library that is released with Ubuntu.

Integration Hints

Developer must set the IP address, netmask, and UDP port into the BACnet/IP module.

Integration used a main loop bare metal design, shown here as an example.

int main(void)
{
    static bool valid_ip_address = false;
    static bool bacnet_ip_initialized = false;

    bacnet_init();
    LwIP_Init();
    /* Infinite loop */
    for (;;) {
        /* Periodic tasks */
        LwIP_Periodic_Handler();
        /* Run when there is a valid IP address */
        if (netif.ip_addr.addr != 0) {
            if (!valid_ip_address) {
                valid_ip_address = true;
                bip_set_addr(netif.ip_addr.addr);
                bip_set_broadcast_addr(
                    (netif.ip_addr.addr & netif.netmask.addr) |
                    (~netif.netmask.addr));
            } else {
                if (bacnet_ip_initialized) {
                    bacnet_task();
                } else {
                    bip_init(NULL);
                    bacnet_ip_initialized = true;
                }
            }
        } else {
            valid_ip_address = false;
        }
    }
}