From 1f75040b5c43679b2d86e9bd28d47033915635a7 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Thu, 30 Apr 2026 08:54:06 -0500 Subject: [PATCH] Revert/remove unmaintained ports 2026 (#1324) * Removed unmaintained ports/uip folder * Removed unmaintained ports/arduino_uno folder * Removed unmaintained ports/pic18* folders and references. * Removed unmaintained ports/rx62n folder. --- doc/README.faq | 48 +- license/ISC | 26 - ports/arduino_uno/Makefile | 207 --- ports/arduino_uno/apdu.c | 128 -- ports/arduino_uno/av.c | 185 --- ports/arduino_uno/av.h | 55 - ports/arduino_uno/bip-init.c | 157 --- ports/arduino_uno/bip.c | 420 ------ ports/arduino_uno/bip.h | 105 -- ports/arduino_uno/bv.c | 233 --- ports/arduino_uno/bv.h | 52 - ports/arduino_uno/bvlc-arduino.c | 167 --- ports/arduino_uno/bvlc-arduino.h | 27 - ports/arduino_uno/datalink.h | 129 -- ports/arduino_uno/device.c | 447 ------ ports/arduino_uno/device.h | 112 -- .../external/Arduino/.clang-format | 5 - .../external/Arduino/.editorconfig | 7 - .../external/Arduino/Ethernet/Makefile | 118 -- .../external/Arduino/Ethernet/include/SPI.h | 69 - .../external/Arduino/Ethernet/include/util.h | 13 - .../external/Arduino/Ethernet/include/w5100.h | 512 ------- .../Arduino/Ethernet/include/w5100Wrapper.h | 139 -- .../external/Arduino/Ethernet/src/SPI.cpp | 63 - .../external/Arduino/Ethernet/src/socket.cpp | 400 ------ .../external/Arduino/Ethernet/src/w5100.cpp | 185 --- .../Arduino/Ethernet/src/w5100Wrapper.cpp | 176 --- .../external/Arduino/core/include/Arduino.h | 235 ---- .../Arduino/core/include/HardwareSerial.h | 117 -- .../external/Arduino/core/include/Server.h | 9 - .../external/Arduino/core/include/USBAPI.h | 202 --- .../external/Arduino/core/include/USBCore.h | 281 ---- .../external/Arduino/core/include/Udp.h | 79 -- .../external/Arduino/core/include/binary.h | 515 ------- .../external/Arduino/core/include/new.h | 21 - .../Arduino/core/include/pins_arduino.h | 205 --- .../Arduino/core/include/wiring_private.h | 57 - ports/arduino_uno/h_rp.c | 141 -- ports/arduino_uno/h_whois.c | 73 - ports/arduino_uno/h_wp.c | 117 -- ports/arduino_uno/main.c | 105 -- ports/arduino_uno/stdbool.h | 28 - ports/arduino_uno/stdint.h | 27 - ports/arduino_uno/txbuf.h | 18 - ports/arduino_uno/uart.c | 43 - ports/arduino_uno/uart.h | 26 - ports/pic18f6720/.clang-format | 7 - ports/pic18f6720/18F6720.lkr | 41 - ports/pic18f6720/BACnet-Server.X/Makefile | 108 -- .../nbproject/Makefile-default.mk | 659 --------- .../nbproject/Makefile-genesis.properties | 6 - .../nbproject/Makefile-impl.mk | 69 - .../nbproject/Makefile-local-default.mk | 37 - .../nbproject/Makefile-variables.mk | 13 - .../nbproject/Package-default.bash | 73 - .../nbproject/configurations.xml | 184 --- .../nbproject/project.properties | 0 .../BACnet-Server.X/nbproject/project.xml | 29 - ports/pic18f6720/BACnet-Server.mcp | 282 ---- ports/pic18f6720/BACnet-Server.mcw | Bin 57344 -> 0 bytes ports/pic18f6720/Makefile | 164 --- ports/pic18f6720/ai.c | 147 -- ports/pic18f6720/apdu.c | 206 --- ports/pic18f6720/av.c | 385 ----- ports/pic18f6720/bi.c | 171 --- ports/pic18f6720/bv.c | 298 ---- ports/pic18f6720/device.c | 775 ---------- ports/pic18f6720/dlmstp.c | 288 ---- ports/pic18f6720/dlmstp.h | 98 -- ports/pic18f6720/hardware.h | 83 -- ports/pic18f6720/isr.c | 173 --- ports/pic18f6720/main.c | 184 --- ports/pic18f6720/mstp.c | 1242 ---------------- ports/pic18f6720/mstp.h | 160 --- ports/pic18f6720/pic18f6720.tpi | 408 ------ ports/pic18f6720/readme.txt | 42 - ports/pic18f6720/rs485.c | 327 ----- ports/pic18f6720/rs485.h | 52 - ports/pic18f6720/stdbool.h | 28 - ports/pic18f6720/stdint.h | 30 - ports/pic18f97j60/.clang-format | 7 - ports/pic18f97j60/BACnet-Server.X/Makefile | 108 -- .../nbproject/Makefile-default.mk | 659 --------- .../nbproject/Makefile-genesis.properties | 8 - .../nbproject/Makefile-impl.mk | 69 - .../nbproject/Makefile-local-default.mk | 37 - .../nbproject/Makefile-variables.mk | 13 - .../nbproject/Package-default.bash | 73 - .../nbproject/configurations.xml | 198 --- .../nbproject/private/configurations.xml | 25 - .../nbproject/private/private.xml | 11 - .../nbproject/project.properties | 0 .../BACnet-Server.X/nbproject/project.xml | 16 - ports/pic18f97j60/Makefile | 145 -- ports/pic18f97j60/ai.c | 147 -- ports/pic18f97j60/apdu.c | 207 --- ports/pic18f97j60/av.c | 385 ----- ports/pic18f97j60/bi.c | 171 --- ports/pic18f97j60/bv.c | 298 ---- ports/pic18f97j60/device.c | 706 ---------- ports/pic18f97j60/dlmstp.c | 288 ---- ports/pic18f97j60/dlmstp.h | 98 -- ports/pic18f97j60/hardware.h | 111 -- ports/pic18f97j60/isr.c | 173 --- ports/pic18f97j60/main.c | 200 --- ports/pic18f97j60/mstp.c | 1250 ----------------- ports/pic18f97j60/mstp.h | 160 --- ports/pic18f97j60/readme.txt | 42 - ports/pic18f97j60/rs485.c | 327 ----- ports/pic18f97j60/rs485.h | 52 - ports/pic18f97j60/stdbool.h | 28 - ports/pic18f97j60/stdint.h | 30 - ports/rx62n/bacnet.c | 112 -- ports/rx62n/bacnet.h | 23 - ports/rx62n/bo.c | 482 ------- ports/rx62n/device.c | 1010 ------------- ports/rx62n/ethernet.c | 229 --- ports/rx62n/hardware.h | 29 - ports/rx62n/led.c | 210 --- ports/rx62n/led.h | 30 - ports/rx62n/main.c | 30 - ports/rx62n/mstimer-init.c | 68 - ports/rx62n/readme.txt | 9 - ports/uip/.clang-format | 7 - ports/uip/_stdint.h | 18 - ports/uip/bip.c | 230 --- ports/uip/net.h | 102 -- ports/uip/stdbool.h | 29 - 128 files changed, 24 insertions(+), 21889 deletions(-) delete mode 100644 license/ISC delete mode 100644 ports/arduino_uno/Makefile delete mode 100644 ports/arduino_uno/apdu.c delete mode 100644 ports/arduino_uno/av.c delete mode 100644 ports/arduino_uno/av.h delete mode 100644 ports/arduino_uno/bip-init.c delete mode 100644 ports/arduino_uno/bip.c delete mode 100644 ports/arduino_uno/bip.h delete mode 100644 ports/arduino_uno/bv.c delete mode 100644 ports/arduino_uno/bv.h delete mode 100644 ports/arduino_uno/bvlc-arduino.c delete mode 100644 ports/arduino_uno/bvlc-arduino.h delete mode 100644 ports/arduino_uno/datalink.h delete mode 100644 ports/arduino_uno/device.c delete mode 100644 ports/arduino_uno/device.h delete mode 100644 ports/arduino_uno/external/Arduino/.clang-format delete mode 100644 ports/arduino_uno/external/Arduino/.editorconfig delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/Makefile delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/include/SPI.h delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/include/util.h delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/include/w5100.h delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/include/w5100Wrapper.h delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/src/SPI.cpp delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/src/socket.cpp delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/src/w5100.cpp delete mode 100644 ports/arduino_uno/external/Arduino/Ethernet/src/w5100Wrapper.cpp delete mode 100644 ports/arduino_uno/external/Arduino/core/include/Arduino.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/HardwareSerial.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/Server.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/USBAPI.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/USBCore.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/Udp.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/binary.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/new.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/pins_arduino.h delete mode 100644 ports/arduino_uno/external/Arduino/core/include/wiring_private.h delete mode 100644 ports/arduino_uno/h_rp.c delete mode 100644 ports/arduino_uno/h_whois.c delete mode 100644 ports/arduino_uno/h_wp.c delete mode 100644 ports/arduino_uno/main.c delete mode 100644 ports/arduino_uno/stdbool.h delete mode 100644 ports/arduino_uno/stdint.h delete mode 100644 ports/arduino_uno/txbuf.h delete mode 100644 ports/arduino_uno/uart.c delete mode 100644 ports/arduino_uno/uart.h delete mode 100644 ports/pic18f6720/.clang-format delete mode 100644 ports/pic18f6720/18F6720.lkr delete mode 100644 ports/pic18f6720/BACnet-Server.X/Makefile delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-default.mk delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-genesis.properties delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-impl.mk delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-local-default.mk delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-variables.mk delete mode 100755 ports/pic18f6720/BACnet-Server.X/nbproject/Package-default.bash delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/configurations.xml delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/project.properties delete mode 100644 ports/pic18f6720/BACnet-Server.X/nbproject/project.xml delete mode 100644 ports/pic18f6720/BACnet-Server.mcp delete mode 100644 ports/pic18f6720/BACnet-Server.mcw delete mode 100644 ports/pic18f6720/Makefile delete mode 100644 ports/pic18f6720/ai.c delete mode 100644 ports/pic18f6720/apdu.c delete mode 100644 ports/pic18f6720/av.c delete mode 100644 ports/pic18f6720/bi.c delete mode 100644 ports/pic18f6720/bv.c delete mode 100644 ports/pic18f6720/device.c delete mode 100644 ports/pic18f6720/dlmstp.c delete mode 100644 ports/pic18f6720/dlmstp.h delete mode 100644 ports/pic18f6720/hardware.h delete mode 100644 ports/pic18f6720/isr.c delete mode 100644 ports/pic18f6720/main.c delete mode 100644 ports/pic18f6720/mstp.c delete mode 100644 ports/pic18f6720/mstp.h delete mode 100644 ports/pic18f6720/pic18f6720.tpi delete mode 100644 ports/pic18f6720/readme.txt delete mode 100644 ports/pic18f6720/rs485.c delete mode 100644 ports/pic18f6720/rs485.h delete mode 100644 ports/pic18f6720/stdbool.h delete mode 100644 ports/pic18f6720/stdint.h delete mode 100644 ports/pic18f97j60/.clang-format delete mode 100644 ports/pic18f97j60/BACnet-Server.X/Makefile delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-default.mk delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-genesis.properties delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-impl.mk delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-local-default.mk delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-variables.mk delete mode 100755 ports/pic18f97j60/BACnet-Server.X/nbproject/Package-default.bash delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/configurations.xml delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/private/configurations.xml delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/private/private.xml delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/project.properties delete mode 100644 ports/pic18f97j60/BACnet-Server.X/nbproject/project.xml delete mode 100644 ports/pic18f97j60/Makefile delete mode 100644 ports/pic18f97j60/ai.c delete mode 100644 ports/pic18f97j60/apdu.c delete mode 100644 ports/pic18f97j60/av.c delete mode 100644 ports/pic18f97j60/bi.c delete mode 100644 ports/pic18f97j60/bv.c delete mode 100644 ports/pic18f97j60/device.c delete mode 100644 ports/pic18f97j60/dlmstp.c delete mode 100644 ports/pic18f97j60/dlmstp.h delete mode 100644 ports/pic18f97j60/hardware.h delete mode 100644 ports/pic18f97j60/isr.c delete mode 100644 ports/pic18f97j60/main.c delete mode 100644 ports/pic18f97j60/mstp.c delete mode 100644 ports/pic18f97j60/mstp.h delete mode 100644 ports/pic18f97j60/readme.txt delete mode 100644 ports/pic18f97j60/rs485.c delete mode 100644 ports/pic18f97j60/rs485.h delete mode 100644 ports/pic18f97j60/stdbool.h delete mode 100644 ports/pic18f97j60/stdint.h delete mode 100644 ports/rx62n/bacnet.c delete mode 100644 ports/rx62n/bacnet.h delete mode 100644 ports/rx62n/bo.c delete mode 100644 ports/rx62n/device.c delete mode 100644 ports/rx62n/ethernet.c delete mode 100644 ports/rx62n/hardware.h delete mode 100644 ports/rx62n/led.c delete mode 100644 ports/rx62n/led.h delete mode 100644 ports/rx62n/main.c delete mode 100644 ports/rx62n/mstimer-init.c delete mode 100644 ports/rx62n/readme.txt delete mode 100644 ports/uip/.clang-format delete mode 100644 ports/uip/_stdint.h delete mode 100644 ports/uip/bip.c delete mode 100644 ports/uip/net.h delete mode 100644 ports/uip/stdbool.h diff --git a/doc/README.faq b/doc/README.faq index dea2bb20..8e954cdd 100644 --- a/doc/README.faq +++ b/doc/README.faq @@ -2,9 +2,7 @@ FAQ - Frequently Asked Questions about the BACnet Stack Q-1: Do you know the typical footprint of the stack (MS/TP use)? -A-1a: It fits on a PIC18F6720 (128K bytes flash 3840 bytes RAM) and there is lots of room for the application - see ports/pic18f6720 project. In one device with 8 Binary Value objects, 8 Binary Input objects, 1 Analog Input object, and supporting ReadProperty, WriteProperty, DeviceCommunicationControl, TimeSync, ReinitializeDevice, Who-Is, I-Am services, the BACnet stack used about 32K words of the code space. - -A-1b: It fits on an ATmega328 (32K bytes flash, 2048 bytes RAM) - see ports/atmega328 project. The BACnet Capabilities include WhoIs, I-Am, ReadProperty, and WriteProperty support. The BACnet objects include a Device object, 11 Binary Value objects, and 12 Analog Value objects. An LED is controlled by Binary Value object instance 99. All required object properties can be retrieved using ReadProperty. The Present_Value property of the Device, Analog Value and Binary Value objects can be written using WriteProperty. The Device ID, MS/TP MAC, Max_Info_Frames, Max_Master, and baud rate can be configured using WriteProperty to an Analog Value present-value. The Device object-name, description, and location can be written using WriteProperty. +A-1: It fits on an ATmega328 (32K bytes flash, 2048 bytes RAM) - see ports/atmega328 project. The BACnet Capabilities include WhoIs, I-Am, ReadProperty, and WriteProperty support. The BACnet objects include a Device object, 11 Binary Value objects, and 12 Analog Value objects. An LED is controlled by Binary Value object instance 99. All required object properties can be retrieved using ReadProperty. The Present_Value property of the Device, Analog Value and Binary Value objects can be written using WriteProperty. The Device ID, MS/TP MAC, Max_Info_Frames, Max_Master, and baud rate can be configured using WriteProperty to an Analog Value present-value. The Device object-name, description, and location can be written using WriteProperty. avr-gcc.exe (GCC) 12.2.0 Program (.text+.data): 28366 bytes (86.6% Full) @@ -19,15 +17,15 @@ Data (.bss+.data): 1850 (45.2% Full) (not including CStack) Q-2: The homepage used to say that the MS/TP code does not work. Still true? -A-2: MS/TP works correctly as of the 0.2.6 release. I spent a several days correcting it while working on the RTOS-32 port, and then a full day fine-tuning it while working on the PIC18F6720 that I used at the 2006 BACnet International Plugfest. I also successfully used MS/TP with the 0.4.0 release at the 2007 BACnet International Plugfest on an Atmel AVR ATmega168. +A-2: MS/TP works correctly as of the 0.2.6 release. Q-3: Does the stack have some specific requirements regarding the hardware (e.g. non-volatile memory, 32-bit CPU, ...)? -A-3: Not really. The specific stuff is in the ports/ directory, and that is expected to be modified by the end user if necessary. Most of the variables are defined using the ANSI C-99 uint8_t, uint16_t, uint32_t, int8_t, int16_t, int32_t from stdint.h, along with bool from stdbool.h. Most of the APDU size returns are int. +A-3: Not really. The specific stuff is in the ports/ directory, and that is expected to be modified by the end user if necessary. Although the source code is mostly C89/C90 compatible, most of the variables are defined using the ANSI C-99 uint8_t, uint16_t, uint32_t, int8_t, int16_t, int32_t from stdint.h, along with bool from stdbool.h. Most of the APDU size returns are int. Q-4: Does the stack have some specific requirements regarding OS? What OS features are used (threads, timers, semaphors, events, mutexes...)? -A-4: No, I did not use any OS features (except for the the ports to specific OS's: port/rtos32/, port/win32/ and port/linux/ which uses some tasks or threads for the MS/TP datalink layer or sockets for the BACnet/IP layers). Since my target was embedded, I kept every thing single-threaded (but multithread safe except where noted) to keep it easy to follow and easy to implement in a microcontroller just running a main() loop. +A-4: No, I did not use any OS features (except for the the ports to specific OS's: ports/win32/, ports/bsd and ports/linux/ which uses some tasks or threads for the MS/TP datalink layer or sockets for the BACnet/IP layers). Since my target was embedded microcontrollers, I kept the architecture single-threaded (but multithread safe except where noted) to keep it easy to follow and easy to implement in a microcontroller just running a main() loop. Q-5: What is the difference between the two datalink layers BACnet/IP and BACnet Ethernet? In BACnet/IP, is the MAC address needed? @@ -37,9 +35,9 @@ BACnet Ethernet uses the Ethernet MAC address, and communicates using the IEEE 8 Q-6: What do I need to do to learn about BACnet? Can this project help? -A-6: Open source projects are great since they allow you to look over the internals of a program or library. However, sometimes you just want to see something work. I created about a dozen example applications for testing. One of the applications is demo/server/bacserv that acts like a BACnet server device. Run it on one PC or hardware platform, and then use the other example applications on another PC to interact with it. Monitor the BACnet network activity with the WireShark protocol analyzer. Modify the example applications - "Take chances, make mistakes, get messy." Have fun! Join the BACnet developers mailing list and ask lots of questions so others can learn and help too! +A-6: Open source projects are great since they allow you to look over the internals of a program or library. However, sometimes you just want to see something work. I created about a dozen example applications for testing. One of the applications is apps/server/bacserv that acts like a BACnet server device. Run it on one PC or hardware platform, and then use the other example applications on another PC to interact with it. Monitor the BACnet network activity with the WireShark protocol analyzer. Modify the example applications - "Take chances, make mistakes, get messy." Have fun! Join the BACnet developers mailing list and ask lots of questions so others can learn and help too! -Q-7: The stack is working fine with demo/server/bacserv. But in the WireShark protocol analyzer, I am able to see only 'Who-Is' and 'I -Am' query/responses. The ReadProperty query/responses are not there in the capture viewer. Why? +Q-7: The stack is working fine with apps/server/bacserv. But in the WireShark protocol analyzer, I am able to see only 'Who-Is' and 'I -Am' query/responses. The ReadProperty query/responses are not there in the capture viewer. Why? A-7: If you are only able to see broadcast messages like Who-Is and I-Am, then you are probably networking using an Ethernet switch (bridge) to connect WireShark to the devices. The Ethernet switch (bridge) actually routes the unicast messages between ports and does not send them to all ports (unless configured to do so). If you use an Ethernet Hub or run WireShark from one of the devices under test, you will then see the ReadProperty messages. @@ -51,9 +49,9 @@ I don't have web services implemented in the BACnet stack at SourceForge, but yo Q-9: How do I create the required objects (analog inputs, analog outputs, binary inputs, binary outputs) to support the hardware on my board? -A-9: See the example application demo/server for an example of a server application with objects included. The simple answer is that they exist in the Device object in the Object_List property. Every BACnet device is required to have a Device Object, and one of the required properties is the Object_List property. +A-9: See the example application apps/server for an example of a server application with objects included. The simple answer is that they exist in the Device object in the Object_List property. Every BACnet device is required to have a Device Object, and one of the required properties is the Object_List property. -The example objects are in demo/object and those that are included in the device are in demo/object/device.c as defined in 5 locations in the file. For each object type: +The example objects are in src/bacnet/basic/object and those that are included in the device are in src/bacnet/basic/object/device.c as defined in 5 locations in the file. For each object type: 1. #include the header file for the object 2. Device_Object_List_Count() needs to include a call to a count function from the object type. @@ -61,33 +59,35 @@ The example objects are in demo/object and those that are included in the device 4. Device_Valid_Object_Id() needs to get the object name for each object. 5. PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED needs to set a bit for each object type supported. -Additionally, for each service that interacts with objects, you will need to include handling for that object. See demo/handler/h_rp.c to see how the different objects are accessed for the ReadProperty service. See demo/handler/h_wp.c to see how the different objects are accessed for the WriteProperty service. If those are the only services that you are going to use, then most of the work has been done other than selecting which object types you are going to support. +Additionally, for each service that interacts with objects, you will need to include handling for that object. See src/bacnet/basic/service/h_rp.c to see how the different objects are accessed for the ReadProperty service. See src/bacnet/basic/service/h_wp.c to see how the different objects are accessed for the WriteProperty service. If those are the only services that you are going to use, then most of the work has been done other than selecting which object types you are going to support. -As for how many of what object, see the individual object files for examples of how that works (see demo/object directory). Also note that there are optional properties of some objects that may or may not have an example included in this demo code. For example, a Binary Value object optionally includes a Priority_Array. There is an example in the demo/object that includes a Priority_Array, and an example in ports/pic18f6720 that does not have the Priority_Array. +As for how many of what object, see the individual object files for examples of how that works (see src/bacnet/basic/object directory). -You can read/write to the properties using demo/readprop and demo/writeprop example client applications that run under Windows or Linux command line. +You can read/write to the properties using apps/readprop and apps/writeprop example client applications that run under Windows, BSD, macOS, or Linux command line. Q-10: Since each Device object must have an object identifier that is unique internetwork-wide, how is this ID determined? A-10: Device object instance number is normally configured on site after the device is installed. Therefore, the Device object instance number should be configurable between 0 and 4194303 inclusive (see bacdef.h for BACNET_MAX_INSTANCE). If your hardware does not have any user interface, you can have the device default to 4194303 and implement WriteProperty service to the Object_Identifier of the Device object. You could also have some other method for configuring the Device Object instance number such as an RS-232 terminal interface or HTTP screen configuration like a home internet router. -Note that 4194303 is known as "unconfigured" and is not really a valid device instance number. Also, all devices are required to respond with their own Device object instance number when 4194303 is requested. +Note that 4194303 is known as "unconfigured" and is not considered a valid device instance number. Also, all devices are required to respond with their own Device object instance number when 4194303 is requested. Q-11: For the objects supported by the device, they are required to be unique within the BACnet device that maintains them. Can I start with an object instance number of 0 or 1 and increment accordingly for each new object created within the device? A-11: For each object type, you can create any object instance numbers between 0 and 4194302 inclusive. How you choose to number them is up to you. -In the example object in demo/object/ I numbered them sequentially starting at 0. If you do choose to use some other numbering scheme, be sure to update the Index_To_Instance(), Valid_Instance(), Count(), and Name() functions of each object type to correctly handle your numbering scheme. +In the example object in src/bacnet/basic/object/ I numbered them sequentially starting at 0. If you do choose to use some other numbering scheme, be sure to update the Index_To_Instance(), Valid_Instance(), Count(), and Name() functions of each object type to correctly handle your numbering scheme. Q-12: For the object names, do you really use AV-## or ANALOG VALUE # in your system? All of our AV values have unique names like "ACTIVE_ALARM", "REVISION", "DUCT_STATIC". A-12: As long as your names are unique in your device (i.e. no duplicate names) you can use your names. In the demo objects, I just use "AV-1" or "ANALOG VALUE 1" as the Object_Name where 1 is the object instance number. Update the Name() function for each object type if you change from the default names. -Q-13: I need to have about 100 Analog Value objects and 100 Binary Value objects in my device. When I try to define over 15 objects I get a memory error from the PIC compiler. What is the problem? +Q-13: I need to have about 100 Analog Output objects and 100 Binary Output objects in my device. When I try to define over 15 objects I get a memory error from the compiler. What is the problem? -A-13: If you are using the unmodified Analog Value or Binary Value objects from demo/objects, they include a priority array. That means that each object has 16 Present_Values stored for each object, plus an Out_Of_Service status. Each object would consume about 17 bytes. 15*17=255 bytes. Limit for udata = 255 bytes on the PIC using the Microchip compiler. +A-13: If you are using Analog Output or Binary Output objects from src/bacnet/basic/object folder, they include a priority array. That means that each object defines 16 Present_Value floats stored for each object, plus all the required properties. -Output and value objects are not required to have Out_Of_Service writable. Value objects are not required to have a priority array. If you need or want to have priority arrays for your objects, then you might consider storing the Binary Value object Present_Value in some smaller form (currently it is stored as enumeration which consumes a byte on a PIC). There are Binary Value and Analog Value object examples that do not include a priority array in the ports/pic18f6720/ directory. +Output objects require a Priority_Array; Value objects are not required to have a Priority_Array. + +There are Binary Value and Analog Value object examples that do not include a priority array. Q-14: What do I have to do to reduce the size of the firmware made from this BACnet stack? @@ -99,8 +99,8 @@ A-14: Here are the things that you can do to shrink the firmware size: * remove the function call to setup the service * remove the service handler 3. Remove unnecessary objects by: - * Remove the demo/object C file from the makefile - * remove function calls to the demo/object C file. + * Remove the src/bacnet/basic/object C file from the makefile + * remove function calls to the src/bacnet/basic/object C file. * Change the number of objects that you have. * Only a Device object is required. * Update the Device object PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED @@ -109,7 +109,7 @@ A-14: Here are the things that you can do to shrink the firmware size: * Compile and Link. If the linker fails, then that function was needed. * Some compilers, like GCC, have garbage collection for unused functions and code. If enabled, the linker will eliminate the unused functions and code. Use the GCC compiler and linker directive to enable this feature. -Q-15: I have downloaded the BACnet stack but can't get demo/server to work. I am using a single computer. In one console window I run demo/server/bacserv. In another console window I run demo/whois/bacwi. When I capture packets with WireShark, I see the I-Am broadcast packet being sent by demo/server/bacserv when it starts. I also see the Who-Is broadcast packet sent by demo/whois/bacwi. But demo/server/bacserv never receives any message. How do I make it work? +Q-15: I have downloaded the BACnet stack but can't get apps/server to work. I am using a single computer. In one console window I run apps/server/bacserv. In another console window I run apps/whois/bacwi. When I capture packets with WireShark, I see the I-Am broadcast packet being sent by apps/server/bacserv when it starts. I also see the Who-Is broadcast packet sent by apps/whois/bacwi. But apps/server/bacserv never receives any message. How do I make it work? A-15: This is a common issue with BACnet/IP. The server application binds to the BACnet/IP UDP port 47808 on that computer, and therefore, the client application is unable to receive broadcast messages on port 47808 since those packets are only going to the server application. You can use the netstat tool to see if the port is in use: @@ -121,9 +121,9 @@ The correct solution is to use BVLC (BACnet Virtual Link Control) where the clie You can do one of the following: 1. Use QEMU or Bochs or VMWare or some other virtual machine to simulate another computer, and run server or client on a virtual computer. - 2. Use the BACnet/IP BACnet Virtual Link Control (BVLC) features. The client demo applications are configured to use environment variables to establish a BBMD connection as a foreign device. Set the BACNET_BBMD_PORT and BACNET_BBMD_ADDRESS of the BBMD, and use a non-standard BACNET_IP_PORT value. Note that the demo/server application is configured as a BBMD, and there are helper scripts /bin/bvlc.sh or bin/bvlc.bat to assist. + 2. Use the BACnet/IP BACnet Virtual Link Control (BVLC) features. The client demo applications are configured to use environment variables to establish a BBMD connection as a foreign device. Set the BACNET_BBMD_PORT and BACNET_BBMD_ADDRESS of the BBMD, and use a non-standard BACNET_IP_PORT value. Note that the apps/server application is configured as a BBMD, and there are helper scripts /bin/bvlc.sh or bin/bvlc.bat to assist. 3. Write npdu router code to route from BACnet/IP to another datalink layer. Make server application on one datalink layer and make client applications on another datalink layer. - 4. Add external BACnet router or BACnet devices. Run a BACnet demo/server on another PC. + 4. Add external BACnet router or BACnet devices. Run a BACnet apps/server on another PC. Q-16: My Linux computer doesn't use eth0 for for the BACnet connection. My Windows computer has more than one network connnection. How can I choose the interface to use for the demo applications? @@ -145,6 +145,6 @@ A-17: Yes, static address binding is supported as of version 0.4.3. Use a file c Q-18: I have downloaded the BACnet stack but can't get Who-Is or EPICS applications to work. When I capture their packets with WireShark, I see Who-Is broadcast packet sent by the client application, but Wireshark shows no I-Am packets. How do I make it work? -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 may 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 diff --git a/license/ISC b/license/ISC deleted file mode 100644 index cbc2a551..00000000 --- a/license/ISC +++ /dev/null @@ -1,26 +0,0 @@ -Valid-License-Identifier: ISC -SPDX-URL: https://spdx.org/licenses/ISC.html -Usage-Guide: - Do not use. Currently only one arduino file is using this license. - - To use the ISC License put the following SPDX tag/value pair into a - comment according to the placement guidelines in the licensing rules - documentation: - SPDX-License-Identifier: ISC -License-Text: - -ISC License - -Copyright (c) - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/ports/arduino_uno/Makefile b/ports/arduino_uno/Makefile deleted file mode 100644 index 4b0615af..00000000 --- a/ports/arduino_uno/Makefile +++ /dev/null @@ -1,207 +0,0 @@ -############################################################################### -# Makefile for BACnet -############################################################################### - -## General Flags -MCU = atmega328p -AVRDUDE_MCU = m328 -TARGET = bacnet -## Tools -CC = avr-gcc -AR = avr-ar -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AVRDUDE = avrdude -LINT = splint - -# programmer id--check the avrdude for complete list -# # of available opts. These should include stk500, -# # avr910, avrisp, bsd, pony and more. Set this to -# # one of the valid "-c PROGRAMMER-ID" values -# # described in the avrdude info page. -# # -AVRDUDE_PROGRAMMERID = avrispmkII -# -# # port--serial or parallel port to which your -# # hardware programmer is attached -# # -AVRDUDE_PORT = /dev/ttyUSB0 - -# Source locations -BACNET_CORE = ../../src -BACNET_INCLUDE = ../../include -BACNET_HANDLER = ../../demo/handler -BACNET_OBJECT = ../../demo/object -BACNET_DEMO = ../../demo -ARDUINO_CORE = external/Arduino/core -ARDUINO_ETHERNET = external/Arduino/Ethernet - -# local files for this project -CSRC = main.c \ - uart.c \ - apdu.c \ - h_rp.c \ - device.c \ - av.c \ - bv.c \ - h_whois.c \ - h_wp.c \ - bip.c \ - bip-init.c \ - bvlc-arduino.c - -# common demo files needed -DEMOSRC = $(BACNET_DEMO)/handler/txbuf.c \ - $(BACNET_DEMO)/handler/h_npdu.c \ - $(BACNET_DEMO)/handler/s_iam.c \ - $(BACNET_DEMO)/handler/noserv.c - -# core BACnet stack files -CORESRC = \ - $(BACNET_CORE)/crc.c \ - $(BACNET_CORE)/npdu.c \ - $(BACNET_CORE)/bacdcode.c \ - $(BACNET_CORE)/bacint.c \ - $(BACNET_CORE)/bacreal.c \ - $(BACNET_CORE)/bacstr.c \ - $(BACNET_CORE)/iam.c \ - $(BACNET_CORE)/rp.c \ - $(BACNET_CORE)/wp.c \ - $(BACNET_CORE)/whois.c \ - $(BACNET_CORE)/bacaddr.c \ - $(BACNET_CORE)/abort.c \ - $(BACNET_CORE)/reject.c \ - $(BACNET_CORE)/bacerror.c \ - $(BACNET_CORE)/bacapp.c - -## Include Directories -INCLUDES = -I. -I$(BACNET_INCLUDE) -INCLUDES += -I$(BACNET_OBJECT) -INCLUDES += -I$(BACNET_HANDLER) -INCLUDES += -I$(ARDUINO_CORE)/include -INCLUDES += -I$(ARDUINO_ETHERNET)/include - -# Source to Object conversion -COBJ = $(CSRC:.c=.o) -DEMOOBJ = $(DEMOSRC:.c=.o) -COREOBJ = $(CORESRC:.c=.o) - - -LIBRARY = lib$(TARGET).a - -## Options common to compile, link and assembly rules -COMMON = -mmcu=$(MCU) -DF_CPU=16000000UL - -#OPTIMIZE_FLAGS = -mcall-prologues -#OPTIMIZE_FLAGS += -finline-functions-called-once -ffunction-sections -fdata-sections -#OPTIMIZATION = -Os $(OPTIMIZE_FLAGS) -OPTIMIZATION = -Os - -#OPTIMIZATION = -O3 $(OPTIMIZE_FLAGS) - -## Compile options common for all C compilation units. -# BFLAGS = -DBACDL_MSTP -#BFLAGS = -DBACDL_ETHERNET=1 -BFLAGS = -DBACDL_BIP=1 -BFLAGS += -DMAX_APDU=100 -BFLAGS += -DBIG_ENDIAN=0 -BFLAGS += -DMAX_TSM_TRANSACTIONS=0 -#BFLAGS += -DCRC_USE_TABLE -BFLAGS += -DBACAPP_REAL -BFLAGS += -DBACAPP_OBJECT_ID -BFLAGS += -DBACAPP_UNSIGNED -BFLAGS += -DBACAPP_ENUMERATED -BFLAGS += -DBACAPP_CHARACTER_STRING -BFLAGS += -DWRITE_PROPERTY -BFLAGS += -DMAX_ANALOG_VALUES=4 -BFLAGS += -DMAX_BINARY_VALUES=4 -#BFLAGS += -DDEBUG -CFLAGS = $(COMMON) -# dead code removal -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -Wall -g2 -gstabs -std=gnu99 $(BFLAGS) $(OPTIMIZATION) -CFLAGS += -MMD -MP -MT $(*F).o -MF dep/$(@F).d -#CFLAGS += -Wall -gdwarf-2 $(BFLAGS) $(OPTIMIZATION) -fsigned-char -#CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d - -## Assembly specific flags -ASMFLAGS = $(COMMON) -ASMFLAGS += $(CFLAGS) -ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 - -## Linker flags -LDFLAGS = $(COMMON) -#dead code removal -LDFLAGS += -Wl,--gc-sections,-static -LDFLAGS += -Wl,-Map=$(TARGET).map,-L.,-l$(TARGET) -LDFLAGS += -Wl,-L$(ARDUINO_ETHERNET)/lib,-lArduinoEthernet -LDFLAGS += -Wl,-L$(ARDUINO_CORE)/lib,-lArduinoUnoCore,-lm - -## Intel Hex file production flags -HEX_FLASH_FLAGS = -R .eeprom -HEX_EEPROM_FLAGS = -j .eeprom -HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" -HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings - -## Objects that must be built in order to link -OBJECTS = $(COBJ) $(DEMOOBJ) -#OBJECTS = $(COBJ) - -## Build -TARGET_ELF=$(TARGET).elf - -all: EthernetLib $(LIBRARY) $(TARGET_ELF) $(TARGET).hex $(TARGET).eep $(TARGET).lst \ - size Makefile - -EthernetLib: - $(MAKE) -s -C external/Arduino/Ethernet all - -##Link -$(TARGET_ELF): $(OBJECTS) $(LIBRARY) - $(CC) $(OBJECTS) $(LDFLAGS) -o $@ - -%.hex: $(TARGET_ELF) - $(OBJCOPY) -O ihex $(HEX_FLASH_FLAGS) $< $@ - -%.eep: $(TARGET_ELF) - -$(OBJCOPY) $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 - -%.lst: $(TARGET_ELF) - $(OBJDUMP) -h -S $< > $@ - -lib: $(LIBRARY) - -$(LIBRARY): $(COREOBJ) Makefile - $(AR) rcs $@ $(COREOBJ) - $(OBJDUMP) --syms $@ > $(LIBRARY:.a=.lst) - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.c -o $@ - -.cpp.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.cpp -o $@ - -size: ${TARGET_ELF} - @echo - @${SIZE} -C --mcu=${MCU} ${TARGET_ELF} - -lint: - $(LINT) $(BFLAGS) $(CSRC) - -install: $(TARGET_ELF) - $(AVRDUDE) -c $(AVRDUDE_PROGRAMMERID) \ - -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -e \ - -U flash:w:$(TARGET).hex - -## Clean target -.PHONY: clean -clean: - -rm -rf $(OBJECTS) $(TARGET_ELF) dep/* - -rm -rf $(LIBRARY) $(COREOBJ) -# -rm -rf $(LIBRARY) $(COREOBJ) $(LIBRARY:.a=.lst) - -rm -rf $(TARGET).hex $(TARGET).eep $(TARGET).lst $(TARGET).map - cd external/Arduino/Ethernet; make clean - -## Other dependencies --include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) diff --git a/ports/arduino_uno/apdu.c b/ports/arduino_uno/apdu.c deleted file mode 100644 index c17f06be..00000000 --- a/ports/arduino_uno/apdu.c +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include -#include -#include -/* BACnet Stack defines - first */ -#include "bacnet/bacdef.h" -/* BACnet Stack API */ -#include "bacnet/apdu.h" -#include "bacnet/bacdcode.h" -#include "bacnet/basic/services.h" - -bool apdu_service_supported(BACNET_SERVICES_SUPPORTED service_supported) -{ - bool status = false; - - if (service_supported == SERVICE_SUPPORTED_READ_PROPERTY) { - status = true; - } - if (service_supported == SERVICE_SUPPORTED_WHO_IS) { - status = true; - } -#ifdef WRITE_PROPERTY - if (service_supported == SERVICE_SUPPORTED_WRITE_PROPERTY) { - status = true; - } -#endif - - return status; -} - -uint16_t apdu_decode_confirmed_service_request( - uint8_t *apdu, /* APDU data */ - - uint16_t apdu_len, - BACNET_CONFIRMED_SERVICE_DATA *service_data, - uint8_t *service_choice, - uint8_t **service_request, - uint16_t *service_request_len) -{ - uint16_t len = 0; /* counts where we are in PDU */ - - service_data->segmented_message = (apdu[0] & BIT(3)) ? true : false; - service_data->more_follows = (apdu[0] & BIT(2)) ? true : false; - service_data->segmented_response_accepted = - (apdu[0] & BIT(1)) ? true : false; - service_data->max_segs = decode_max_segs(apdu[1]); - service_data->max_resp = decode_max_apdu(apdu[1]); - service_data->invoke_id = apdu[2]; - len = 3; - if (service_data->segmented_message) { - service_data->sequence_number = apdu[len++]; - service_data->proposed_window_number = apdu[len++]; - } - *service_choice = apdu[len++]; - *service_request = &apdu[len]; - *service_request_len = apdu_len - len; - - return len; -} - -void apdu_handler( - BACNET_ADDRESS *src, - uint8_t *apdu, /* APDU data */ - - uint16_t apdu_len) -{ - BACNET_CONFIRMED_SERVICE_DATA service_data = { 0 }; - uint8_t service_choice = 0; - uint8_t *service_request = NULL; - uint16_t service_request_len = 0; - uint16_t len = 0; /* counts where we are in PDU */ - - if (apdu) { - /* PDU Type */ - switch (apdu[0] & 0xF0) { - case PDU_TYPE_CONFIRMED_SERVICE_REQUEST: - len = apdu_decode_confirmed_service_request( - &apdu[0], /* APDU data */ - apdu_len, &service_data, &service_choice, &service_request, - &service_request_len); - if (len == 0) { - /* service data unable to be decoded - simply drop */ - break; - } - if (service_choice == SERVICE_CONFIRMED_READ_PROPERTY) { - handler_read_property( - service_request, service_request_len, src, - &service_data); - } -#ifdef WRITE_PROPERTY - else if (service_choice == SERVICE_CONFIRMED_WRITE_PROPERTY) { - handler_write_property( - service_request, service_request_len, src, - &service_data); - } -#endif - else { - handler_unrecognized_service( - service_request, service_request_len, src, - &service_data); - } - break; - case PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST: - service_choice = apdu[1]; - service_request = &apdu[2]; - service_request_len = apdu_len - 2; - if (service_choice == SERVICE_UNCONFIRMED_WHO_IS) { - handler_who_is(service_request, service_request_len, src); - } - break; - case PDU_TYPE_SIMPLE_ACK: - case PDU_TYPE_COMPLEX_ACK: - case PDU_TYPE_SEGMENT_ACK: - case PDU_TYPE_ERROR: - case PDU_TYPE_REJECT: - case PDU_TYPE_ABORT: - default: - break; - } - } - return; -} diff --git a/ports/arduino_uno/av.c b/ports/arduino_uno/av.c deleted file mode 100644 index bcedce88..00000000 --- a/ports/arduino_uno/av.c +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Analog Value Objects - customize for your use */ - -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/bacapp.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/basic/object/av.h" - -#if (MAX_ANALOG_VALUES > 10) -#error Modify the Analog_Value_Name to handle multiple digits -#endif - -float AV_Present_Value[MAX_ANALOG_VALUES]; - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need validate that the */ -/* given instance exists */ -bool Analog_Value_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_ANALOG_VALUES) { - return true; - } - - return false; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then count how many you have */ -unsigned Analog_Value_Count(void) -{ - return MAX_ANALOG_VALUES; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the instance */ -/* that correlates to the correct index */ -uint32_t Analog_Value_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the index */ -/* that correlates to the correct instance number */ -unsigned Analog_Value_Instance_To_Index(uint32_t object_instance) -{ - return object_instance; -} - -/* note: the object name must be unique within this device */ -char *Analog_Value_Name(uint32_t object_instance) -{ - static char text_string[5] = "AV-"; /* okay for single thread */ - - text_string[3] = '0' + (uint8_t)object_instance; - - return text_string; -} - -/* return apdu len, or -1 on error */ -int Analog_Value_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - unsigned object_index; - - switch (property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_ANALOG_VALUE, object_instance); - break; - case PROP_OBJECT_NAME: - characterstring_init_ansi( - &char_string, Analog_Value_Name(object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE); - break; - case PROP_PRESENT_VALUE: - object_index = Analog_Value_Instance_To_Index(object_instance); - apdu_len = encode_application_real( - &apdu[0], AV_Present_Value[object_index]); - break; - case PROP_STATUS_FLAGS: - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_UNITS: - apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT); - break; - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (array_index != BACNET_ARRAY_ALL)) { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Analog_Value_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Analog_Value_Valid_Instance(wp_data->object_instance)) { - *error_class = ERROR_CLASS_OBJECT; - *error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_REAL) { - object_index = - Analog_Value_Instance_To_Index(wp_data->object_instance); - AV_Present_Value[object_index] = value.type.Real; - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - } - - return status; -} diff --git a/ports/arduino_uno/av.h b/ports/arduino_uno/av.h deleted file mode 100644 index fd97a475..00000000 --- a/ports/arduino_uno/av.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef AV_H -#define AV_H - -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacerror.h" -#include "bacnet/wp.h" - -#ifndef MAX_ANALOG_VALUES -#define MAX_ANALOG_VALUES 4 -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -void Analog_Value_Property_Lists( - const int32_t **pRequired, - const int32_t **pOptional, - const int32_t **pProprietary); -bool Analog_Value_Valid_Instance(uint32_t object_instance); -unsigned Analog_Value_Count(void); -uint32_t Analog_Value_Index_To_Instance(unsigned index); -char *Analog_Value_Name(uint32_t object_instance); - -int Analog_Value_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -bool Analog_Value_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -bool Analog_Value_Present_Value_Set( - uint32_t object_instance, float value, uint8_t priority); -float Analog_Value_Present_Value(uint32_t object_instance); - -void Analog_Value_Init(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/arduino_uno/bip-init.c b/ports/arduino_uno/bip-init.c deleted file mode 100644 index ce95a6a8..00000000 --- a/ports/arduino_uno/bip-init.c +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include /* for standard integer types uint8_t etc. */ -#include /* for the standard bool type. */ -#include -#include "bacnet/bacdcode.h" -#include "bacnet/datalink/bip.h" -#include "socketWrapper.h" -#include "w5100Wrapper.h" -// #include "bacport.h" - -/** @file linux/bip-init.c Initializes BACnet/IP interface (Linux). */ - -static bool BIP_Debug = false; - -/** - * @brief Enabled debug printing of BACnet/IPv4 - */ -void bip_debug_enable(void) -{ - BIP_Debug = true; -} - -/** - * @brief Disalbe debug printing of BACnet/IPv4 - */ -void bip_debug_disable(void) -{ - BIP_Debug = false; -} - -/* gets an IP address by name, where name can be a - string that is an IP address in dotted form, or - a name that is a domain name - returns 0 if not found, or - an IP address in network byte order */ -long bip_getaddrbyname(const char *host_name) -{ - return 0; -} - -/** Gets the local IP address and local broadcast address from the system, - * and saves it into the BACnet/IP data structures. - * - * @param ifname [in] The named interface to use for the network layer. - * Eg, for Linux, ifname is eth0, ath0, arc0, and others. - */ -void bip_set_interface(const char *ifname) -{ - uint8_t local_address[] = { 0, 0, 0, 0 }; - uint8_t broadcast_address[] = { 0, 0, 0, 0 }; - uint8_t netmask[] = { 0, 0, 0, 0 }; - uint8_t invertedNetmask[] = { 0, 0, 0, 0 }; - - getIPAddress_func(CW5100Class_new(), local_address); - bip_set_addr(local_address); - if (BIP_Debug) { - fprintf(stderr, "Interface: %s\n", ifname); - fprintf( - stderr, "IP Address: %d.%d.%d.%d\n", local_address[0], - local_address[1], local_address[2], local_address[3]); - } - - /* setup local broadcast address */ - getSubnetMask_func(CW5100Class_new(), netmask); - for (int i = 0; i < 4; i++) { // FIXME: IPv4 ? - invertedNetmask[i] = ~netmask[i]; - broadcast_address[i] = (local_address[i] | invertedNetmask[i]); - } - - bip_set_broadcast_addr(broadcast_address); - if (BIP_Debug) { - fprintf( - stderr, "IP Broadcast Address: %d.%d.%d.%d\n", broadcast_address[0], - broadcast_address[1], broadcast_address[2], broadcast_address[3]); - } -} - -/** Initialize the BACnet/IP services at the given interface. - * @ingroup DLBIP - * -# Gets the local IP address and local broadcast address from the system, - * and saves it into the BACnet/IP data structures. - * -# Opens a UDP socket - * -# Configures the socket for sending and receiving - * -# Configures the socket so it can send broadcasts - * -# Binds the socket to the local IP address at the specified port for - * BACnet/IP (by default, 0xBAC0 = 47808). - * - * @note For Linux, ifname is eth0, ath0, arc0, and others. - * - * @param ifname [in] The named interface to use for the network layer. - * If NULL, the "eth0" interface is assigned. - * @return True if the socket is successfully opened for BACnet/IP, - * else False if the socket functions fail. - */ -bool bip_init(char *ifname) -{ - uint8_t sock_fd = 0; - bool isOpen = false; - - if (ifname) { - bip_set_interface(ifname); - } else { - bip_set_interface("eth0"); - } - - /* assumes that the driver has already been initialized */ - for (sock_fd = 0; sock_fd < MAX_SOCK_NUM; sock_fd++) { - if (readSnSR_func(CW5100Class_new(), sock_fd) == SnSR_CLOSED()) { - socket_func(sock_fd, SnMR_UDP(), (uint16_t)47808, 0); - listen_func(sock_fd); - isOpen = true; - break; - } - } - - if (!isOpen) { - bip_set_socket(MAX_SOCK_NUM); - return false; - } else { - bip_set_socket(sock_fd); - } - - return true; -} - -/** Cleanup and close out the BACnet/IP services by closing the socket. - * @ingroup DLBIP - */ -void bip_cleanup(void) -{ - int sock_fd = 0; - - if (bip_valid()) { - sock_fd = bip_socket(); - close_func(sock_fd); - } - bip_set_socket(MAX_SOCK_NUM); - bip_set_broadcast_port(0); - - return; -} - -/** Get the netmask of the BACnet/IP's interface via an ioctl() call. - * @param netmask [out] The netmask, in host order. - * @return 0 on success, else the error from the ioctl() call. - */ -int bip_get_local_netmask(uint8_t *netmask) -{ - getSubnetMask_func(CW5100Class_new(), netmask); - return 0; -} diff --git a/ports/arduino_uno/bip.c b/ports/arduino_uno/bip.c deleted file mode 100644 index 68dc7ed8..00000000 --- a/ports/arduino_uno/bip.c +++ /dev/null @@ -1,420 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include /* for standard integer types uint8_t etc. */ -#include /* for the standard bool type. */ -#include -#include "bacnet/bacdcode.h" -#include "bacnet/bacint.h" -#include "bacnet/datalink/bip.h" -#include "bvlc-arduino.h" -#include "socketWrapper.h" -#include "w5100Wrapper.h" - -#if PRINT_ENABLED | DEBUG -#include /* for standard i/o, like printing */ -#endif - -/** @file bip.c Configuration and Operations for BACnet/IP */ - -static uint8_t BIP_Socket = MAX_SOCK_NUM; -/* port to use - stored in network byte order */ -static uint16_t BIP_Port = 0; /* this will force initialization in demos */ -/* broadcast destination port to use */ -static uint16_t BIP_Broadcast_Port; -/* IP Address - stored in network byte order */ -// static struct in_addr BIP_Address; -static uint8_t BIP_Address[4] = { 0, 0, 0, 0 }; -/* Broadcast Address - stored in network byte order */ -// static struct in_addr BIP_Broadcast_Address; -static uint8_t BIP_Broadcast_Address[4] = { 0, 0, 0, 0 }; - -/** Converter from uint8_t[4] type address to uint32_t - * - */ -uint32_t convertBIP_Address2uint32(const suint8_t *bip_address) -{ - return (uint32_t)((bip_address[0] * 2 ^ 24) + (bip_address[1] * 2 ^ 16) + - (bip_address[2] * 2 ^ 8) + bip_address[3]); -} - -/** Convert from uint32_t IPv4 address to uint8_t[4] address - * - */ -void convertUint32Address_2_uint8Address(uint32_t ip, uint8_t *address) -{ - address[0] = (uint8_t)(ip >> 24); - address[1] = (uint8_t)(ip >> 16); - address[2] = (uint8_t)(ip >> 8); - address[3] = (uint8_t)(ip >> 0); -} - -/** Setter for the BACnet/IP socket handle. - * - * @param sock_fd [in] Handle for the BACnet/IP socket. - */ -void bip_set_socket(uint8_t sock_fd) -{ - BIP_Socket = sock_fd; -} - -/** Getter for the BACnet/IP socket handle. - * - * @return The handle to the BACnet/IP socket. - */ -uint8_t bip_socket(void) -{ - return BIP_Socket; -} - -bool bip_valid(void) -{ - return (BIP_Socket < MAX_SOCK_NUM); -} - -void bip_set_addr(const uint8_t *net_address) -{ /* in network byte order */ - for (uint8_t i = 0; i < 4; i++) { - BIP_Address[i] = net_address[i]; - } -} - -/* returns network byte order */ -uint8_t *bip_get_addr(void) -{ - return BIP_Address; -} - -void bip_set_broadcast_addr(const uint8_t *net_address) -{ /* in network byte order */ - for (uint8_t i = 0; i < 4; i++) { - BIP_Broadcast_Address[i] = net_address[i]; - } -} - -/* returns network byte order */ -uint8_t *bip_get_broadcast_addr(void) -{ - return BIP_Broadcast_Address; -} - -void bip_set_port(uint16_t port) -{ /* in network byte order */ - BIP_Port = htons(port); -} - -void bip_set_broadcast_port(uint16_t port) -{ /* in network byte order */ - BIP_Broadcast_Port = htons(port); -} - -/* returns network byte order */ -uint16_t bip_get_port(void) -{ - return ntohs(BIP_Port); -} - -uint16_t bip_get_broadcast_port(void) -{ - if (BIP_Broadcast_Port) { - return ntohs(BIP_Broadcast_Port); - } - - return ntohs(BIP_Port); -} - -static int bip_decode_bip_address( - const BACNET_ADDRESS *bac_addr, - uint8_t *address, /* in network format */ - uint16_t *port) -{ /* in network format */ - int len = 0; - - if (bac_addr) { - memcpy(address, &bac_addr->mac[0], 4); - memcpy(port, &bac_addr->mac[4], 2); - len = 6; - } - - return len; -} - -/** Function to send a packet out the BACnet/IP socket (Annex J). - * @ingroup DLBIP - * - * @param dest [in] Destination address (may encode an IP address and port #). - * @param npdu_data [in] The NPDU header (Network) information (not used). - * @param pdu [in] Buffer of data to be sent - may be null (why?). - * @param pdu_len [in] Number of bytes in the pdu buffer. - * @return Number of bytes sent on success, negative number on failure. - */ -int bip_send_pdu( - BACNET_ADDRESS *dest, /* destination address */ - - BACNET_NPDU_DATA *npdu_data, /* network information */ - - uint8_t *pdu, /* any data to be sent - may be null */ - - unsigned pdu_len) -{ /* number of bytes of data */ - - uint8_t mtu[BIP_MPDU_MAX] = { 0 }; - int mtu_len = 0; - int bytes_sent = 0; - /* addr and port in host format */ - uint8_t address[] = { 0, 0, 0, 0 }; - uint16_t port = 0; - - (void)npdu_data; - /* assumes that the driver has already been initialized */ - if (BIP_Socket < 0) { - return BIP_Socket; - } - - mtu[0] = BVLL_TYPE_BACNET_IP; - if ((dest->net == BACNET_BROADCAST_NETWORK) || - ((dest->net > 0) && (dest->len == 0)) || (dest->mac_len == 0)) { - /* broadcast */ - for (uint8_t i = 0; i < 4; i++) { - address[i] = BIP_Broadcast_Address[i]; - } - port = htons(bip_get_broadcast_port()); - mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU; -#ifdef DEBUG - fprintf( - stderr, "Send Broadcast NPDU to %d.%d.%d.%d:%d\n", address[0], - address[1], address[2], address[3], port); -#endif - } else if (dest->mac_len == 6) { - bip_decode_bip_address(dest, address, &port); - mtu[1] = BVLC_ORIGINAL_UNICAST_NPDU; -#ifdef DEBUG - fprintf( - stderr, "Send Unicast NPDU to %d.%d.%d.%d:%d\n", address[0], - address[1], address[2], address[3], port); -#endif - } else { - /* invalid address */ - return -1; - } - - mtu_len = 2; - mtu_len += encode_unsigned16( - &mtu[mtu_len], (uint16_t)(pdu_len + 4 /*inclusive */)); - memcpy(&mtu[mtu_len], pdu, pdu_len); - mtu_len += pdu_len; - -#ifdef DEBUG - fprintf(stderr, "MTU size %d\n", mtu_len); -#endif - - /* Send the packet */ - bytes_sent = sendto_func(BIP_Socket, mtu, (uint16_t)mtu_len, address, port); - - return bytes_sent; -} - -/** Implementation of the receive() function for BACnet/IP; receives one - * packet, verifies its BVLC header, and removes the BVLC header from - * the PDU data before returning. - * - * @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, - * after the BVLC portion has been stripped - * off. - * @param max_pdu [in] Size of the pdu[] buffer. - * @param timeout [in] The number of milliseconds to wait for a packet. - * @return The number of octets (remaining) in the PDU, or zero on failure. - */ -uint16_t bip_receive( - BACNET_ADDRESS *src, /* source address */ - - uint8_t *pdu, /* PDU data */ - - uint16_t max_pdu, /* amount of space available in the PDU */ - - unsigned timeout) -{ - int received_bytes = 0; - int max = 0; - uint16_t pdu_len = 0; /* return value */ - uint8_t src_addr[] = { 0, 0, 0, 0 }; - uint16_t src_port = 0; - uint16_t i = 0; - int function = 0; - - /* Make sure the socket is open */ - if (BIP_Socket < 0) { - return 0; - } - - if (getRXReceivedSize_func(CW5100Class_new(), BIP_Socket)) { - memcpy(&src_addr, &src->mac[0], 4); - memcpy(&src_port, &src->mac[4], 2); - received_bytes = (int)recvfrom_func( - BIP_Socket, &pdu[0], max_pdu, src_addr, &src_port); - } - - /* See if there is a problem */ - if (received_bytes < 0) { - return 0; - } - - /* no problem, just no bytes */ - if (received_bytes == 0) { - return 0; - } - - /* the signature of a BACnet/IP packet */ - if (pdu[0] != BVLL_TYPE_BACNET_IP) { - return 0; - } - - /* Erase up to 16 bytes after the received bytes as safety margin to - * ensure that the decoding functions will run into a 'safe field' - * of zero, if for any reason they would overrun, when parsing the - * message. */ - max = (int)max_pdu - received_bytes; - if (max > 0) { - if (max > 16) { - max = 16; - } - memset(&pdu[received_bytes], 0, max); - } - - if (bvlc_for_non_bbmd(src_addr, &src_port, pdu, received_bytes) > 0) { - /* Handled, usually with a NACK. */ -#if PRINT_ENABLED - fprintf(stderr, "BIP: BVLC discarded!\n"); -#endif - return 0; - } - - function = bvlc_get_function_code(); /* aka, pdu[1] */ - if ((function == BVLC_ORIGINAL_UNICAST_NPDU) || - (function == BVLC_ORIGINAL_BROADCAST_NPDU)) { - /* ignore messages from me */ - if ((convertBIP_Address2uint32(src_addr) == - convertBIP_Address2uint32(BIP_Address)) && - (src_port == BIP_Port)) { - pdu_len = 0; -#if 0 - fprintf(stderr, "BIP: src is me. Discarded!\n"); -#endif - } else { - /* data in src->mac[] is in network format */ - src->mac_len = 6; - memcpy(&src->mac[0], &src_addr, 4); - memcpy(&src->mac[4], &src_port, 2); -#ifdef DEBUG - fprintf( - stderr, "BIP receive from %d.%d.%d.%d\n", src->mac[0], - src->mac[1], src->mac[2], src->mac[3]); -#endif - /* FIXME: check destination address */ - /* see if it is broadcast or for us */ - /* decode the length of the PDU - length is inclusive of BVLC */ - (void)decode_unsigned16(&pdu[2], &pdu_len); - /* subtract off the BVLC header */ - pdu_len -= 4; - if (pdu_len < max_pdu) { -#if 0 - fprintf(stderr, "BIP: NPDU[%hu]:", pdu_len); -#endif - /* shift the buffer to return a valid PDU */ - for (i = 0; i < pdu_len; i++) { - pdu[i] = pdu[4 + i]; -#if 0 - fprintf(stderr, "%02X ", pdu[i]); -#endif - } -#if 0 - fprintf(stderr, "\n"); -#endif - } - /* ignore packets that are too large */ - /* clients should check my max-apdu first */ - else { - pdu_len = 0; -#if PRINT_ENABLED - fprintf(stderr, "BIP: PDU too large. Discarded!.\n"); -#endif - } - } - } else if (function == BVLC_FORWARDED_NPDU) { - memcpy(&src_addr, &pdu[4], 4); - memcpy(&src_port, &pdu[8], 2); - if ((convertBIP_Address2uint32(src_addr) == - convertBIP_Address2uint32(BIP_Address)) && - (src_port == BIP_Port)) { - /* ignore messages from me */ - pdu_len = 0; - } else { - /* data in src->mac[] is in network format */ - src->mac_len = 6; - memcpy(&src->mac[0], &src_addr, 4); - memcpy(&src->mac[4], &src_port, 2); - /* FIXME: check destination address */ - /* see if it is broadcast or for us */ - /* decode the length of the PDU - length is inclusive of BVLC */ - (void)decode_unsigned16(&pdu[2], &pdu_len); - /* subtract off the BVLC header */ - pdu_len -= 10; - if (pdu_len < max_pdu) { - /* shift the buffer to return a valid PDU */ - for (i = 0; i < pdu_len; i++) { - pdu[i] = pdu[4 + 6 + i]; - } - } else { - /* ignore packets that are too large */ - /* clients should check my max-apdu first */ - pdu_len = 0; - } - } - } - - return pdu_len; -} - -void bip_get_my_address(BACNET_ADDRESS *my_address) -{ - int i = 0; - - if (my_address) { - my_address->mac_len = 6; - memcpy(&my_address->mac[0], &BIP_Address, 4); - memcpy(&my_address->mac[4], &BIP_Port, 2); - my_address->net = 0; /* local only, no routing */ - my_address->len = 0; /* no SLEN */ - for (i = 0; i < MAX_MAC_LEN; i++) { - /* no SADR */ - my_address->adr[i] = 0; - } - } - - return; -} - -void bip_get_broadcast_address(BACNET_ADDRESS *dest) -{ /* destination address */ - int i = 0; /* counter */ - uint16_t port = htons(bip_get_broadcast_port()); - - if (dest) { - dest->mac_len = 6; - memcpy(&dest->mac[0], &BIP_Broadcast_Address, 4); - memcpy(&dest->mac[4], &port, 2); - dest->net = BACNET_BROADCAST_NETWORK; - dest->len = 0; /* no SLEN */ - for (i = 0; i < MAX_MAC_LEN; i++) { - /* no SADR */ - dest->adr[i] = 0; - } - } - - return; -} diff --git a/ports/arduino_uno/bip.h b/ports/arduino_uno/bip.h deleted file mode 100644 index fa12026a..00000000 --- a/ports/arduino_uno/bip.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2012 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef BIP_H -#define BIP_H - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/npdu.h" - -/* specific defines for BACnet/IP over Ethernet */ -#define BIP_HEADER_MAX (1 + 1 + 2) -#define BIP_MPDU_MAX (BIP_HEADER_MAX + MAX_PDU) - -#define BVLL_TYPE_BACNET_IP (0x81) - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* note: define init, set_interface, and cleanup in your port */ -/* on Linux, ifname is eth0, ath0, arc0, and others. - on Windows, ifname is the dotted ip address of the interface */ -bool bip_init(char *ifname); -void bip_set_interface(const char *ifname); -void bip_cleanup(void); - -/* Convert uint8_t IPv4 to uint32 */ -uint32_t convertBIP_Address2uint32(const uint8_t *bip_address); -void convertUint32Address_2_uint8Address(uint32_t ip, uint8_t *address); -/* common BACnet/IP functions */ -void bip_set_socket(uint8_t sock_fd); -uint8_t bip_socket(void); -bool bip_valid(void); -void bip_get_broadcast_address(BACNET_ADDRESS *dest); /* destination address */ -void bip_get_my_address(BACNET_ADDRESS *my_address); - -/* function to send a packet out the BACnet/IP socket */ -/* returns zero on success, non-zero on failure */ -int bip_send_pdu( - BACNET_ADDRESS *dest, /* destination address */ - - BACNET_NPDU_DATA *npdu_data, /* network information */ - - uint8_t *pdu, /* any data to be sent - may be null */ - - unsigned pdu_len); /* number of bytes of data */ - -/* receives a BACnet/IP packet */ -/* returns the number of octets in the PDU, or zero on failure */ -uint16_t bip_receive( - BACNET_ADDRESS *src, /* source address */ - - uint8_t *pdu, /* PDU data */ - - uint16_t max_pdu, /* amount of space available in the PDU */ - - unsigned timeout); /* milliseconds to wait for a packet */ - -/* use host byte order for setting */ -void bip_set_port(uint16_t port); -void bip_set_broadcast_port(uint16_t port); -/* returns host byte order */ -uint16_t bip_get_port(void); -uint16_t bip_get_broadcast_port(void); - -/* use network byte order for setting */ -void bip_set_addr(const uint8_t *net_address); -/* returns network byte order */ -uint8_t *bip_get_addr(void); - -/* use network byte order for setting */ -void bip_set_broadcast_addr(const uint8_t *net_address); -/* returns network byte order */ -uint8_t *bip_get_broadcast_addr(void); - -/* gets an IP address by name, where name can be a - string that is an IP address in dotted form, or - a name that is a domain name - returns 0 if not found, or - an IP address in network byte order */ -long bip_getaddrbyname(const char *host_name); - -void bip_debug_enable(void); - -void bip_debug_disable(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -/** @defgroup DLBIP BACnet/IP DataLink Network Layer - * @ingroup DataLink - * Implementation of the Network Layer using BACnet/IP as the transport, as - * described in Annex J. - * The functions described here fulfill the roles defined generically at the - * DataLink level by serving as the implementation of the function templates. - * - */ -#endif diff --git a/ports/arduino_uno/bv.c b/ports/arduino_uno/bv.c deleted file mode 100644 index cb1547cc..00000000 --- a/ports/arduino_uno/bv.c +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Value Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/basic/object/bv.h" - -#if (MAX_BINARY_VALUES > 10) -#error Modify the Binary_Value_Name to handle multiple digits -#endif - -static BACNET_BINARY_PV Present_Value[MAX_BINARY_VALUES]; - -/* we simply have 0-n object instances. */ -bool Binary_Value_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_VALUES) { - return true; - } - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Count(void) -{ - return MAX_BINARY_VALUES; -} - -/* we simply have 0-n object instances. */ -uint32_t Binary_Value_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_VALUES; - - if (object_instance < MAX_BINARY_VALUES) { - index = object_instance; - } - - return index; -} - -static BACNET_BINARY_PV Binary_Value_Present_Value(uint32_t object_instance) -{ - BACNET_BINARY_PV value = BINARY_INACTIVE; - - if (object_instance < MAX_BINARY_VALUES) { - value = Present_Value[object_instance]; - } - - return value; -} - -/* note: the object name must be unique within this device */ -char *Binary_Value_Name(uint32_t object_instance) -{ - static char text_string[5] = "BV-0"; /* okay for single thread */ - - if (object_instance < MAX_BINARY_VALUES) { - text_string[3] = '0' + (uint8_t)object_instance; - return text_string; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Binary_Value_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_BINARY_PV present_value = BINARY_INACTIVE; - BACNET_POLARITY polarity = POLARITY_NORMAL; - - switch (property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_BINARY_VALUE, object_instance); - break; - /* note: Name and Description don't have to be the same. - You could make Description writable and different */ - case PROP_OBJECT_NAME: - characterstring_init_ansi( - &char_string, Binary_Value_Name(object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE); - break; - case PROP_PRESENT_VALUE: - present_value = Binary_Value_Present_Value(object_instance); - apdu_len = encode_application_enumerated(&apdu[0], present_value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_POLARITY: - /* FIXME: figure out the polarity */ - apdu_len = encode_application_enumerated(&apdu[0], polarity); - break; - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (array_index != BACNET_ARRAY_ALL)) { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Binary_Value_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Binary_Value_Valid_Instance(wp_data->object_instance)) { - *error_class = ERROR_CLASS_OBJECT; - *error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) { - if ((value.type.Enumerated == BINARY_ACTIVE) || - (value.type.Enumerated == BINARY_INACTIVE)) { - object_index = Binary_Value_Instance_To_Index( - wp_data->object_instance); - /* NOTE: this Binary value has no priority array */ - Present_Value[object_index] = - (BACNET_BINARY_PV)value.type.Enumerated; - /* Note: you could set the physical output here if we - are the highest priority. - However, if Out of Service is TRUE, then don't set the - physical output. */ - if (Present_Value[0] == BINARY_ACTIVE) { - // LED_GREEN_ON(); - } else { - // LED_GREEN_OFF(); - } - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#if 0 - case PROP_OUT_OF_SERVICE: - if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) { - object_index = - Binary_Value_Instance_To_Index(wp_data->object_instance); - Binary_Value_Out_Of_Service[object_index] = value.type.Boolean; - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#endif - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - } - - return status; -} diff --git a/ports/arduino_uno/bv.h b/ports/arduino_uno/bv.h deleted file mode 100644 index 13cb06b1..00000000 --- a/ports/arduino_uno/bv.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef BV_H -#define BV_H - -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacerror.h" -#include "bacnet/wp.h" - -#ifndef MAX_BINARY_VALUES -#define MAX_BINARY_VALUES 10 -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -void Binary_Value_Property_Lists( - const int32_t **pRequired, - const int32_t **pOptional, - const int32_t **pProprietary); -bool Binary_Value_Valid_Instance(uint32_t object_instance); -unsigned Binary_Value_Count(void); -uint32_t Binary_Value_Index_To_Instance(unsigned index); -char *Binary_Value_Name(uint32_t object_instance); - -void Binary_Value_Init(void); - -int Binary_Value_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -bool Binary_Value_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/arduino_uno/bvlc-arduino.c b/ports/arduino_uno/bvlc-arduino.c deleted file mode 100644 index c8f417db..00000000 --- a/ports/arduino_uno/bvlc-arduino.c +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @file - * @author Miguel Fernandes - * @date 6 de Jun de 2013 - * @brief BACnet Virtual Link Control for Wiznet on Arduino-Uno - */ -#include -#include -#include - -#include "bvlc-arduino.h" -#include "bacnet/datalink/bip.h" -#include "bacnet/bacint.h" -#include "socketWrapper.h" -#include "w5100Wrapper.h" - -/** result from a client request */ -BACNET_BVLC_RESULT BVLC_Result_Code = BVLC_RESULT_SUCCESSFUL_COMPLETION; -/** The current BVLC Function Code being handled. */ -BACNET_BVLC_FUNCTION BVLC_Function_Code = BVLC_RESULT; /* A safe default */ - -/** Encode the BVLC Result message - * - * @param pdu - buffer to store the encoding - * @param result_code - BVLC result code - * - * @return number of bytes encoded - */ -static int bvlc_encode_bvlc_result(uint8_t *pdu, BACNET_BVLC_RESULT result_code) -{ - if (pdu) { - pdu[0] = BVLL_TYPE_BACNET_IP; - pdu[1] = BVLC_RESULT; - /* The 2-octet BVLC Length field is the length, in octets, - of the entire BVLL message, including the two octets of the - length field itself, most significant octet first. */ - encode_unsigned16(&pdu[2], 6); - encode_unsigned16(&pdu[4], (uint16_t)result_code); - } - - return 6; -} - -/** - * The common send function for bvlc functions, using b/ip. - * - * @param dest_addr - Points to a sockaddr_in structure containing the - * destination address. The length and format of the address depend - * on the address family of the socket (AF_INET). - * The address is in network byte order. - * @param dest_port - Destination port number - * @param mtu - the bytes of data to send - * @param mtu_len - the number of bytes of data to send - * @return Upon successful completion, returns the number of bytes sent. - * Otherwise, -1 shall be returned to indicate the error. - */ -static int bvlc_send_mpdu( - const uint8_t *dest_addr, /* the destination address */ - const uint16_t *dest_port, /* the destination port */ - uint8_t *mtu, /* the data */ - uint16_t mtu_len) -{ /* amount of data to send */ - /* assumes that the driver has already been initialized */ - if (bip_valid()) { - return 0; - } - - return sendto_func(bip_socket(), mtu, mtu_len, dest_addr, *dest_port); -} - -/** Sends a BVLC Result - * - * @param dest_addr - destination address - * @param dest_port - destination port - */ -static void bvlc_send_result( - const uint8_t *dest_addr, - const uint16_t *dest_port, /* the destination address */ - BACNET_BVLC_RESULT result_code) -{ - uint8_t mtu[BIP_MPDU_MAX] = { 0 }; - uint16_t mtu_len = 0; - - mtu_len = (uint16_t)bvlc_encode_bvlc_result(&mtu[0], result_code); - bvlc_send_mpdu(dest_addr, dest_port, mtu, mtu_len); - - return; -} - -/** Note any BVLC_RESULT code, or NAK the BVLL message in the unsupported cases. - * Use this handler when you are not a BBMD. - * Sets the BVLC_Function_Code in case it is needed later. - * - * @param addr [in] Socket address to send any NAK back to. - * @param port [in] Socket port - * @param npdu [in] The received buffer. - * @param received_bytes [in] How many bytes in npdu[]. - * @return Non-zero BVLC_RESULT_ code if we sent a response (NAK) to this - * BVLC message. If zero, may need further processing. - */ -uint16_t bvlc_for_non_bbmd( - uint8_t *addr, uint16_t *port, uint8_t *npdu, uint16_t received_bytes) -{ - uint16_t result_code = 0; /* aka, BVLC_RESULT_SUCCESSFUL_COMPLETION */ - - /* To check the BVLC-function code, the buffer of received - * bytes has to be at least one byte long. */ - if (received_bytes >= 1) { - BVLC_Function_Code = npdu[1]; /* The BVLC function */ - switch (BVLC_Function_Code) { - case BVLC_RESULT: - if (received_bytes >= 6) { - /* This is the result of our foreign device registration */ - (void)decode_unsigned16(&npdu[4], &result_code); - BVLC_Result_Code = (BACNET_BVLC_RESULT)result_code; - fprintf(stderr, "BVLC: Result Code=%d\n", BVLC_Result_Code); - /* But don't send any response */ - result_code = 0; - } - break; - case BVLC_WRITE_BROADCAST_DISTRIBUTION_TABLE: - result_code = - BVLC_RESULT_WRITE_BROADCAST_DISTRIBUTION_TABLE_NAK; - break; - case BVLC_READ_BROADCAST_DIST_TABLE: - result_code = BVLC_RESULT_READ_BROADCAST_DISTRIBUTION_TABLE_NAK; - break; - /* case BVLC_READ_BROADCAST_DIST_TABLE_ACK: */ - case BVLC_REGISTER_FOREIGN_DEVICE: - result_code = BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK; - break; - case BVLC_READ_FOREIGN_DEVICE_TABLE: - result_code = BVLC_RESULT_READ_FOREIGN_DEVICE_TABLE_NAK; - break; - /* case BVLC_READ_FOREIGN_DEVICE_TABLE_ACK: */ - case BVLC_DELETE_FOREIGN_DEVICE_TABLE_ENTRY: - result_code = BVLC_RESULT_DELETE_FOREIGN_DEVICE_TABLE_ENTRY_NAK; - break; - case BVLC_DISTRIBUTE_BROADCAST_TO_NETWORK: - result_code = BVLC_RESULT_DISTRIBUTE_BROADCAST_TO_NETWORK_NAK; - break; - /* case BVLC_FORWARDED_NPDU: */ - /* case BVLC_ORIGINAL_UNICAST_NPDU: */ - /* case BVLC_ORIGINAL_BROADCAST_NPDU: */ - default: - break; - } - } - - if (result_code > 0) { - bvlc_send_result(addr, port, result_code); - fprintf(stderr, "BVLC: NAK code=%d\n", result_code); - } - return result_code; -} - -/** Returns the current BVLL Function Code we are processing. - * We have to store this higher layer code for when the lower layers - * need to know what it is, especially to differentiate between - * BVLC_ORIGINAL_UNICAST_NPDU and BVLC_ORIGINAL_BROADCAST_NPDU. - * - * @return A BVLC_ function code, such as BVLC_ORIGINAL_UNICAST_NPDU. - */ -BACNET_BVLC_FUNCTION bvlc_get_function_code(void) -{ - return BVLC_Function_Code; -} diff --git a/ports/arduino_uno/bvlc-arduino.h b/ports/arduino_uno/bvlc-arduino.h deleted file mode 100644 index 3d8fece0..00000000 --- a/ports/arduino_uno/bvlc-arduino.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file - * @author Miguel Fernandes - * @date 6 de Jun de 2013 - * @brief BACnet Virtual Link Control for Wiznet on Arduino-Uno - */ -#ifndef BVLCARDUINO_H_ -#define BVLCARDUINO_H_ - -#include -#include "bacnet/bacenum.h" -#include "bacnet/bacdef.h" -#include "bacnet/npdu.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -uint16_t bvlc_for_non_bbmd( - uint8_t *addr, uint16_t *port, uint8_t *npdu, uint16_t received_bytes); - -BACNET_BVLC_FUNCTION bvlc_get_function_code(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* BVLCARDUINO_H_ */ diff --git a/ports/arduino_uno/datalink.h b/ports/arduino_uno/datalink.h deleted file mode 100644 index 3db6e940..00000000 --- a/ports/arduino_uno/datalink.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2012 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef DATALINK_H -#define DATALINK_H - -#include "bacnet/config.h" -#include "bacnet/bacdef.h" - -#if defined(BACDL_ETHERNET) -#include "bacnet/datalink/ethernet.h" -#endif -#if defined(BACDL_ARCNET) -#include "bacnet/datalink/arcnet.h" -#endif -#if defined(BACDL_MSTP) -#include "bacnet/datalink/dlmstp.h" -#endif -#if defined(BACDL_BIP) -#include "bacnet/datalink/bip.h" -#include "bvlc-arduino.h" -#endif -#if defined(BACDL_BIP6) -#error currently not implemented for Arduino -#endif - -#if defined(BACDL_ETHERNET) && !defined(BACDL_MULTIPLE) -#define datalink_init ethernet_init -#define datalink_send_pdu ethernet_send_pdu -#define datalink_receive ethernet_receive -#define datalink_cleanup ethernet_cleanup -#define datalink_get_broadcast_address ethernet_get_broadcast_address -#define datalink_get_my_address ethernet_get_my_address - -#elif defined(BACDL_ARCNET) && !defined(BACDL_MULTIPLE) -#define datalink_init arcnet_init -#define datalink_send_pdu arcnet_send_pdu -#define datalink_receive arcnet_receive -#define datalink_cleanup arcnet_cleanup -#define datalink_get_broadcast_address arcnet_get_broadcast_address -#define datalink_get_my_address arcnet_get_my_address - -#elif defined(BACDL_MSTP) && !defined(BACDL_MULTIPLE) -#define datalink_init dlmstp_init -#define datalink_send_pdu dlmstp_send_pdu -#define datalink_receive dlmstp_receive -#define datalink_cleanup dlmstp_cleanup -#define datalink_get_broadcast_address dlmstp_get_broadcast_address -#define datalink_get_my_address dlmstp_get_my_address - -#elif defined(BACDL_BIP) && !defined(BACDL_MULTIPLE) - -#define datalink_init bip_init -// #if defined(BBMD_ENABLED) && BBMD_ENABLED -// #define datalink_send_pdu bvlc_send_pdu -// #define datalink_receive bvlc_receive -// #else -#define datalink_send_pdu bip_send_pdu -#define datalink_receive bip_receive -// #endif -#define datalink_cleanup bip_cleanup -#define datalink_get_broadcast_address bip_get_broadcast_address -#ifdef BAC_ROUTING -extern void routed_get_my_address(BACNET_ADDRESS *my_address); -#define datalink_get_my_address routed_get_my_address -#else -#define datalink_get_my_address bip_get_my_address -#endif - -#else /* Ie, BACDL_MULTIPLE */ -#include "bacnet/npdu.h" - -#define MAX_HEADER (8) -#define MAX_MPDU (MAX_HEADER + MAX_PDU) - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -int datalink_send_pdu( - BACNET_ADDRESS *dest, - BACNET_NPDU_DATA *npdu_data, - uint8_t *pdu, - unsigned pdu_len); -extern uint16_t datalink_receive( - BACNET_ADDRESS *src, uint8_t *pdu, uint16_t max_pdu, unsigned timeout); -extern void datalink_cleanup(void); -extern void datalink_get_broadcast_address(BACNET_ADDRESS *dest); -extern void datalink_get_my_address(BACNET_ADDRESS *my_address); -extern void datalink_set_interface(char *ifname); -extern void datalink_set(char *datalink_string); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif -/** @defgroup DataLink The BACnet Network (DataLink) Layer - * 6 THE NETWORK LAYER
- * The purpose of the BACnet network layer is to provide the means by which - * messages can be relayed from one BACnet network to another, regardless of - * the BACnet data link technology in use on that network. Whereas the data - * link layer provides the capability to address messages to a single device - * or broadcast them to all devices on the local network, the network layer - * allows messages to be directed to a single remote device, broadcast on a - * remote network, or broadcast globally to all devices on all networks. - * A BACnet Device is uniquely located by a network number and a MAC address. - * - * Each client or server application must define exactly one of these - * DataLink settings, which will control which parts of the code will be built: - * - BACDL_ETHERNET -- for Clause 7 ISO 8802-3 ("Ethernet") LAN - * - BACDL_ARCNET -- for Clause 8 ARCNET LAN - * - BACDL_MSTP -- for Clause 9 MASTER-SLAVE/TOKEN PASSING (MS/TP) LAN - * - BACDL_BIP -- for ANNEX J - BACnet/IP - * - BACDL_ALL -- Unspecified for the build, so the transport can be - * chosen at runtime from among these choices. - * - Clause 10 POINT-TO-POINT (PTP) and Clause 11 EIA/CEA-709.1 ("LonTalk") LAN - * are not currently supported by this project. - */ -/** @defgroup DLTemplates DataLink Template Functions - * @ingroup DataLink - * Most of the functions in this group are function templates which are assigned - * to a specific DataLink network layer implementation either at compile time or - * at runtime. - */ -#endif diff --git a/ports/arduino_uno/device.c b/ports/arduino_uno/device.c deleted file mode 100644 index 52d47cd3..00000000 --- a/ports/arduino_uno/device.c +++ /dev/null @@ -1,447 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacstr.h" -#include "bacnet/bacenum.h" -#include "bacnet/apdu.h" -#include "bacnet/dcc.h" -#include "bacnet/datalink/dlmstp.h" -#include "bacnet/version.h" - -/* objects */ -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/av.h" -#include "bacnet/basic/object/bv.h" -#include "bacnet/wp.h" - -/* note: you really only need to define variables for - properties that are writable or that may change. - The properties that are constant can be hard coded - into the read-property encoding. */ -static uint32_t Object_Instance_Number = 260001; -static char Object_Name[20] = "My Device"; -static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL; - -void Device_Init(void) -{ - /* Reinitialize_State = BACNET_REINIT_IDLE; */ - /* dcc_set_status_duration(COMMUNICATION_ENABLE, 0); */ - /* FIXME: Get the data from the eeprom */ - /* I2C_Read_Block(EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ -} - -/* methods to manipulate the data */ -uint32_t Device_Object_Instance_Number(void) -{ - return Object_Instance_Number; -} - -bool Device_Set_Object_Instance_Number(uint32_t object_id) -{ - bool status = true; /* return value */ - - if (object_id <= BACNET_MAX_INSTANCE) { - Object_Instance_Number = object_id; - /* FIXME: Write the data to the eeprom */ - /* I2C_Write_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ - } else { - status = false; - } - - return status; -} - -bool Device_Valid_Object_Instance_Number(uint32_t object_id) -{ - /* BACnet allows for a wildcard instance number */ - return ( - (Object_Instance_Number == object_id) || - (object_id == BACNET_MAX_INSTANCE)); -} - -uint16_t Device_Vendor_Identifier(void) -{ - return BACNET_VENDOR_ID; -} - -unsigned Device_Object_List_Count(void) -{ - unsigned count = 1; /* at least 1 for device object */ - - /* FIXME: add objects as needed */ - count += Analog_Value_Count(); - count += Binary_Value_Count(); - - return count; -} - -bool Device_Object_List_Identifier( - uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance) -{ - bool status = false; - uint32_t object_index = 0; - uint32_t object_count = 0; - - /* device object */ - if (array_index == 1) { - *object_type = OBJECT_DEVICE; - *instance = Object_Instance_Number; - status = true; - } - /* normalize the index since - we know it is not the previous objects */ - /* array index starts at 1 */ - object_index = array_index - 1; - /* 1 for the device object */ - object_count = 1; - /* FIXME: add objects as needed */ - /* analog value objects */ - if (!status) { - /* array index starts at 1, and 1 for the device object */ - object_index -= object_count; - object_count = Analog_Value_Count(); - if (object_index < object_count) { - *object_type = OBJECT_ANALOG_VALUE; - *instance = Analog_Value_Index_To_Instance(object_index); - status = true; - } - } - /* binary value objects */ - if (!status) { - object_index -= object_count; - object_count = Binary_Value_Count(); - /* is it a valid index for this object? */ - if (object_index < object_count) { - *object_type = OBJECT_BINARY_VALUE; - *instance = Binary_Value_Index_To_Instance(object_index); - status = true; - } - } - - return status; -} - -/* return the length of the apdu encoded or -1 for error */ -int Device_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - int apdu_len = 0; /* return value */ - int len = 0; /* apdu len intermediate value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - uint32_t i = 0; - BACNET_OBJECT_TYPE object_type = OBJECT_NONE; - uint32_t instance = 0; - uint32_t count = 0; - - // object_instance = object_instance; - /* FIXME: change the hardcoded names to suit your application */ - switch (property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_DEVICE, Object_Instance_Number); - break; - case PROP_OBJECT_NAME: - characterstring_init_ansi(&char_string, Object_Name); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = encode_application_enumerated(&apdu[0], OBJECT_DEVICE); - break; - case PROP_SYSTEM_STATUS: - apdu_len = encode_application_enumerated(&apdu[0], System_Status); - break; - case PROP_VENDOR_NAME: - characterstring_init_ansi(&char_string, BACNET_VENDOR_NAME); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_VENDOR_IDENTIFIER: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Vendor_Identifier()); - break; - case PROP_MODEL_NAME: - characterstring_init_ansi(&char_string, "GNU Demo"); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_FIRMWARE_REVISION: - characterstring_init_ansi(&char_string, BACNET_VERSION_TEXT); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_APPLICATION_SOFTWARE_VERSION: - characterstring_init_ansi(&char_string, "1.0"); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_PROTOCOL_VERSION: - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_VERSION); - break; - case PROP_PROTOCOL_REVISION: - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_REVISION); - break; - case PROP_PROTOCOL_SERVICES_SUPPORTED: - /* Note: list of services that are executed, not initiated. */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { - /* automatic lookup based on handlers set */ - bitstring_set_bit( - &bit_string, (uint8_t)i, - apdu_service_supported((BACNET_SERVICES_SUPPORTED)i)); - } - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - /* Note: this is the list of objects that can be in this device, - not a list of objects that this device can access */ - bitstring_init(&bit_string); - /* must have the bit string as big as it can be */ - for (i = 0; i < MAX_ASHRAE_OBJECT_TYPE; i++) { - /* initialize all the object types to not-supported */ - bitstring_set_bit(&bit_string, (uint8_t)i, false); - } - /* FIXME: indicate the objects that YOU support */ - bitstring_set_bit(&bit_string, OBJECT_DEVICE, true); - bitstring_set_bit(&bit_string, OBJECT_ANALOG_VALUE, true); - bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_OBJECT_LIST: - count = Device_Object_List_Count(); - /* Array element zero is the number of objects in the list */ - if (array_index == 0) { - apdu_len = encode_application_unsigned(&apdu[0], count); - } - /* if no index was specified, then try to encode the entire list */ - /* into one packet. Note that more than likely you will have */ - /* to return an error if the number of encoded objects exceeds */ - /* your maximum APDU size. */ - else if (array_index == BACNET_ARRAY_ALL) { - for (i = 1; i <= count; i++) { - Device_Object_List_Identifier(i, &object_type, &instance); - len = encode_application_object_id( - &apdu[apdu_len], object_type, instance); - apdu_len += len; - /* assume next one is the same size as this one */ - /* can we all fit into the APDU? */ - if ((apdu_len + len) >= MAX_APDU) { - /* Abort response */ - *error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - apdu_len = BACNET_STATUS_ABORT; - break; - } - } - } else { - if (Device_Object_List_Identifier( - array_index, &object_type, &instance)) { - apdu_len = encode_application_object_id( - &apdu[0], object_type, instance); - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - apdu_len = BACNET_STATUS_ERROR; - } - } - break; - case PROP_MAX_APDU_LENGTH_ACCEPTED: - apdu_len = encode_application_unsigned(&apdu[0], MAX_APDU); - break; - case PROP_SEGMENTATION_SUPPORTED: - apdu_len = - encode_application_enumerated(&apdu[0], SEGMENTATION_NONE); - break; - case PROP_APDU_TIMEOUT: - apdu_len = encode_application_unsigned(&apdu[0], 60000); - break; - case PROP_NUMBER_OF_APDU_RETRIES: - apdu_len = encode_application_unsigned(&apdu[0], 0); - break; - case PROP_DEVICE_ADDRESS_BINDING: - /* FIXME: encode the list here, if it exists */ - break; - case PROP_DATABASE_REVISION: - apdu_len = encode_application_unsigned(&apdu[0], 0); - break; - // case PROP_MAX_INFO_FRAMES: - // apdu_len = - // encode_application_unsigned(&apdu[0], - // dlmstp_max_info_frames()); - // break; - // case PROP_MAX_MASTER: - // apdu_len = - // encode_application_unsigned(&apdu[0], - // dlmstp_max_master()); - // break; - // case 9600: - // apdu_len = - // encode_application_unsigned(&apdu[0], - // RS485_Get_Baud_Rate()); - // break; - // case 512: - // apdu_len = encode_application_unsigned(&apdu[0], - // stack_size()); break; - // case 513: - // apdu_len = encode_application_unsigned(&apdu[0], - // stack_unused()); break; - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (property != PROP_OBJECT_LIST) && - (array_index != BACNET_ARRAY_ALL)) { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -bool Device_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - bool status = false; /* return value */ - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Device_Valid_Object_Instance_Number(wp_data->object_instance)) { - *error_class = ERROR_CLASS_OBJECT; - *error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - switch (wp_data->object_property) { - case PROP_OBJECT_IDENTIFIER: - if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { - if ((value.type.Object_Id.type == OBJECT_DEVICE) && - (Device_Set_Object_Instance_Number( - value.type.Object_Id.instance))) { - /* we could send an I-Am broadcast to let the world know */ - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - // case PROP_MAX_INFO_FRAMES: - // if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) - // { - // if (value.type.Unsigned_Int <= 255) { - // dlmstp_set_max_info_frames(value.type.Unsigned_Int); - // status = true; - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - // } - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_INVALID_DATA_TYPE; - // } - // break; - // case PROP_MAX_MASTER: - // if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) - // { - // if ((value.type.Unsigned_Int > 0) && - // (value.type.Unsigned_Int <= 127)) { - // dlmstp_set_max_master(value.type.Unsigned_Int); - // status = true; - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - // } - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_INVALID_DATA_TYPE; - // } - // break; - case PROP_OBJECT_NAME: - if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) { - uint8_t encoding; - - encoding = - characterstring_encoding(&value.type.Character_String); - if (encoding == CHARACTER_ANSI_X34) { - if (characterstring_ansi_copy( - &Object_Name[0], sizeof(Object_Name), - &value.type.Character_String)) { - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY; - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED; - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - // case 9600: - // if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) - // { - // if (value.type.Unsigned_Int > 115200) { - // RS485_Set_Baud_Rate(value.type.Unsigned_Int); - // status = true; - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - // } - // } else { - // *error_class = ERROR_CLASS_PROPERTY; - // *error_code = ERROR_CODE_INVALID_DATA_TYPE; - // } - // break; - default: - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - } - - return status; -} diff --git a/ports/arduino_uno/device.h b/ports/arduino_uno/device.h deleted file mode 100644 index be785ce1..00000000 --- a/ports/arduino_uno/device.h +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef DEVICE_H -#define DEVICE_H - -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacenum.h" -#include "bacnet/wp.h" -#include "bacnet/readrange.h" - -typedef unsigned (*object_count_function)(void); -typedef uint32_t (*object_index_to_instance_function)(unsigned index); -typedef char *(*object_name_function)(uint32_t object_instance); - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -void Device_Object_Function_Set( - BACNET_OBJECT_TYPE object_type, - object_count_function count_function, - object_index_to_instance_function index_function, - object_name_function name_function); - -void Device_Init(void); - -void Device_Property_Lists( - const int32_t **pRequired, - const int32_t **pOptional, - const int32_t **pProprietary); - -uint32_t Device_Object_Instance_Number(void); -bool Device_Set_Object_Instance_Number(uint32_t object_id); -bool Device_Valid_Object_Instance_Number(uint32_t object_id); -unsigned Device_Object_List_Count(void); -bool Device_Object_List_Identifier( - uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance); - -BACNET_DEVICE_STATUS Device_System_Status(void); -void Device_Set_System_Status(BACNET_DEVICE_STATUS status); - -const char *Device_Vendor_Name(void); - -uint16_t Device_Vendor_Identifier(void); - -const char *Device_Model_Name(void); -bool Device_Set_Model_Name(const char *name, size_t length); - -const char *Device_Firmware_Revision(void); - -const char *Device_Application_Software_Version(void); -bool Device_Set_Application_Software_Version(const char *name, size_t length); - -bool Device_Set_Object_Name(const char *name, size_t length); -const char *Device_Object_Name(void); - -const char *Device_Description(void); -bool Device_Set_Description(const char *name, size_t length); - -const char *Device_Location(void); -bool Device_Set_Location(const char *name, size_t length); - -/* some stack-centric constant values - no set methods */ -uint8_t Device_Protocol_Version(void); -uint8_t Device_Protocol_Revision(void); -BACNET_SEGMENTATION Device_Segmentation_Supported(void); - -uint8_t Device_Database_Revision(void); -void Device_Set_Database_Revision(uint8_t revision); - -bool Device_Valid_Object_Name( - const char *object_name, - BACNET_OBJECT_TYPE *object_type, - uint32_t *object_instance); -char *Device_Valid_Object_Id( - BACNET_OBJECT_TYPE object_type, uint32_t object_instance); - -int Device_Encode_Property_APDU( - uint8_t *apdu, - uint32_t object_instance, - BACNET_PROPERTY_ID property, - uint32_t array_index, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -bool Device_Write_Property( - BACNET_WRITE_PROPERTY_DATA *wp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -bool DeviceGetRRInfo( - uint32_t Object, /* Which particular object - obviously not important for - device object */ - - BACNET_PROPERTY_ID Property, /* Which property */ - - RR_PROP_INFO *pInfo, /* Where to put the information */ - - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/arduino_uno/external/Arduino/.clang-format b/ports/arduino_uno/external/Arduino/.clang-format deleted file mode 100644 index 617477f5..00000000 --- a/ports/arduino_uno/external/Arduino/.clang-format +++ /dev/null @@ -1,5 +0,0 @@ ---- -DisableFormat: true - -# DisableFormat will not disable include sorting with some versions. -SortIncludes: Never diff --git a/ports/arduino_uno/external/Arduino/.editorconfig b/ports/arduino_uno/external/Arduino/.editorconfig deleted file mode 100644 index 0fd45c99..00000000 --- a/ports/arduino_uno/external/Arduino/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -# External folder so ignore everything. -[*] -charset = unset -insert_final_newline = unset -trim_trailing_whitespace = unset -indent_style = unset -end_of_line = unset diff --git a/ports/arduino_uno/external/Arduino/Ethernet/Makefile b/ports/arduino_uno/external/Arduino/Ethernet/Makefile deleted file mode 100644 index 2ea14957..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -############################################################################### -# Makefile for BACnet -############################################################################### - -## General Flags -MCU = atmega328p -AVRDUDE_MCU = m328 -TARGET = ArduinoEthernet -## Tools -CC = avr-gcc -AR = avr-ar -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AVRDUDE = avrdude -LINT = splint - -# programmer id--check the avrdude for complete list -# # of available opts. These should include stk500, -# # avr910, avrisp, bsd, pony and more. Set this to -# # one of the valid "-c PROGRAMMER-ID" values -# # described in the avrdude info page. -# # -AVRDUDE_PROGRAMMERID = avrispmkII -# -# # port--serial or parallel port to which your -# # hardware programmer is attached -# # -AVRDUDE_PORT = /dev/ttyUSB0 - -# local files for this project -#CSRC = main.c - -ARDUINOSRC = \ - src/socket.cpp \ - src/w5100.cpp \ - src/SPI.cpp \ - src/w5100Wrapper.cpp \ - src/socketWrapper.cpp - -## Include Directories -INCLUDES = -Iinclude -INCLUDES += -I../core/include - -LIBRARY = lib$(TARGET).a - -## Options common to compile, link and assembly rules -COMMON = -mmcu=$(MCU) - -OPTIMIZE_FLAGS = -mcall-prologues -#OPTIMIZE_FLAGS += -finline-functions -OPTIMIZE_FLAGS += -finline-functions-called-once -#OPTIMIZATION = -O0 -#OPTIMIZATION = -Os -OPTIMIZATION = -Os $(OPTIMIZE_FLAGS) -#OPTIMIZATION = -O3 $(OPTIMIZE_FLAGS) - -## Compile options common for all C compilation units. -CFLAGS = $(COMMON) -# dead code removal -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -Wall -gdwarf-2 $(OPTIMIZATION) -fsigned-char -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d - -## Assembly specific flags -ASMFLAGS = $(COMMON) -ASMFLAGS += $(CFLAGS) -ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 - -## Linker flags -LDFLAGS = $(COMMON) -#dead code removal -#LDFLAGS += -Wl,-nostartfiles,-nostdlib -LDFLAGS += -Wl,--gc-sections,-static -LDFLAGS += -Wl,-Map=$(TARGET).map,-L.,-l$(TARGET) -#LDFLAGS += -Wl,-Map=$(TARGET).map -LDFLAGS += -L../core/lib,-lArduinoUnoCore - -## Intel Hex file production flags -HEX_FLASH_FLAGS = -R .eeprom -HEX_EEPROM_FLAGS = -j .eeprom -HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" -HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings - -## Objects that must be built in order to link -OBJS := ${SRCS:.cpp=.o} - -all: $(LIBRARY) size Makefile - -default: all - -lib: $(LIBRARY) - -$(LIBRARY): $(OBJS) Makefile - $(AR) rcs lib/$@ $(OBJS) - $(OBJDUMP) --syms lib/$@ > lib/$(LIBRARY:.a=.lst) - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.c -o $@ - -.cpp.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.cpp -o $@ - -size: ${TARGET_ELF} - @echo - @${SIZE} ${TARGET_ELF} - -lint: - $(LINT) $(BFLAGS) $(CSRC) - -## Clean target -.PHONY: clean -clean: - -rm -rf $(OBJS) dep/* - -rm -rf $(LIBRARY) $(OBJS) - -## Other dependencies --include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) diff --git a/ports/arduino_uno/external/Arduino/Ethernet/include/SPI.h b/ports/arduino_uno/external/Arduino/Ethernet/include/SPI.h deleted file mode 100644 index c405c2f4..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/include/SPI.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2010 by Cristian Maglie - * SPI Master library for arduino. - * - * SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.1-only - */ - -#ifndef _SPI_H_INCLUDED -#define _SPI_H_INCLUDED - -#include -#include -#include - -#define SPI_CLOCK_DIV4 0x00 -#define SPI_CLOCK_DIV16 0x01 -#define SPI_CLOCK_DIV64 0x02 -#define SPI_CLOCK_DIV128 0x03 -#define SPI_CLOCK_DIV2 0x04 -#define SPI_CLOCK_DIV8 0x05 -#define SPI_CLOCK_DIV32 0x06 -//#define SPI_CLOCK_DIV64 0x07 - -#define SPI_MODE0 0x00 -#define SPI_MODE1 0x04 -#define SPI_MODE2 0x08 -#define SPI_MODE3 0x0C - -#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR -#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR -#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR - -class SPIClass { - public: - inline static byte transfer(byte _data); - - // SPI Configuration methods - - inline static void attachInterrupt(); - inline static void detachInterrupt(); // Default - - static void begin(); // Default - static void end(); - - static void setBitOrder(uint8_t); - static void setDataMode(uint8_t); - static void setClockDivider(uint8_t); -}; - -extern SPIClass SPI; - -byte SPIClass::transfer(byte _data) -{ - SPDR = _data; - while (!(SPSR & _BV(SPIF))); - return SPDR; -} - -void SPIClass::attachInterrupt() -{ - SPCR |= _BV(SPIE); -} - -void SPIClass::detachInterrupt() -{ - SPCR &= ~_BV(SPIE); -} - -#endif diff --git a/ports/arduino_uno/external/Arduino/Ethernet/include/util.h b/ports/arduino_uno/external/Arduino/Ethernet/include/util.h deleted file mode 100644 index 5042e82e..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/include/util.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef UTIL_H -#define UTIL_H - -#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) ) -#define ntohs(x) htons(x) - -#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \ - ((x)<< 8 & 0x00FF0000UL) | \ - ((x)>> 8 & 0x0000FF00UL) | \ - ((x)>>24 & 0x000000FFUL) ) -#define ntohl(x) htonl(x) - -#endif diff --git a/ports/arduino_uno/external/Arduino/Ethernet/include/w5100.h b/ports/arduino_uno/external/Arduino/Ethernet/include/w5100.h deleted file mode 100644 index 892fc74d..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/include/w5100.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright (c) 2010 by Cristian Maglie - * - * SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.1-only - */ - -#ifndef W5100_H_INCLUDED -#define W5100_H_INCLUDED - -#include -#include - -#define MAX_SOCK_NUM 4 - -typedef uint8_t SOCKET; - -#define IDM_OR 0x8000 -#define IDM_AR0 0x8001 -#define IDM_AR1 0x8002 -#define IDM_DR 0x8003 -/* -class MR { -public: - static const uint8_t RST = 0x80; - static const uint8_t PB = 0x10; - static const uint8_t PPPOE = 0x08; - static const uint8_t LB = 0x04; - static const uint8_t AI = 0x02; - static const uint8_t IND = 0x01; -}; -*/ -/* -class IR { -public: - static const uint8_t CONFLICT = 0x80; - static const uint8_t UNREACH = 0x40; - static const uint8_t PPPoE = 0x20; - static const uint8_t SOCK0 = 0x01; - static const uint8_t SOCK1 = 0x02; - static const uint8_t SOCK2 = 0x04; - static const uint8_t SOCK3 = 0x08; - static inline uint8_t SOCK(SOCKET ch) { return (0x01 << ch); }; -}; -*/ - -class SnMR { - public: - static const uint8_t CLOSE = 0x00; - static const uint8_t TCP = 0x01; - static const uint8_t UDP = 0x02; - static const uint8_t IPRAW = 0x03; - static const uint8_t MACRAW = 0x04; - static const uint8_t PPPOE = 0x05; - static const uint8_t ND = 0x20; - static const uint8_t MULTI = 0x80; -}; - -enum SockCMD { - Sock_OPEN = 0x01, - Sock_LISTEN = 0x02, - Sock_CONNECT = 0x04, - Sock_DISCON = 0x08, - Sock_CLOSE = 0x10, - Sock_SEND = 0x20, - Sock_SEND_MAC = 0x21, - Sock_SEND_KEEP = 0x22, - Sock_RECV = 0x40 -}; - -/*class SnCmd { -public: - static const uint8_t OPEN = 0x01; - static const uint8_t LISTEN = 0x02; - static const uint8_t CONNECT = 0x04; - static const uint8_t DISCON = 0x08; - static const uint8_t CLOSE = 0x10; - static const uint8_t SEND = 0x20; - static const uint8_t SEND_MAC = 0x21; - static const uint8_t SEND_KEEP = 0x22; - static const uint8_t RECV = 0x40; -}; -*/ - -class SnIR { - public: - static const uint8_t SEND_OK = 0x10; - static const uint8_t TIMEOUT = 0x08; - static const uint8_t RECV = 0x04; - static const uint8_t DISCON = 0x02; - static const uint8_t CON = 0x01; -}; - -class SnSR { - public: - static const uint8_t CLOSED = 0x00; - static const uint8_t INIT = 0x13; - static const uint8_t LISTEN = 0x14; - static const uint8_t SYNSENT = 0x15; - static const uint8_t SYNRECV = 0x16; - static const uint8_t ESTABLISHED = 0x17; - static const uint8_t FIN_WAIT = 0x18; - static const uint8_t CLOSING = 0x1A; - static const uint8_t TIME_WAIT = 0x1B; - static const uint8_t CLOSE_WAIT = 0x1C; - static const uint8_t LAST_ACK = 0x1D; - static const uint8_t UDP = 0x22; - static const uint8_t IPRAW = 0x32; - static const uint8_t MACRAW = 0x42; - static const uint8_t PPPOE = 0x5F; -}; - -class IPPROTO { - public: - static const uint8_t IP = 0; - static const uint8_t ICMP = 1; - static const uint8_t IGMP = 2; - static const uint8_t GGP = 3; - static const uint8_t TCP = 6; - static const uint8_t PUP = 12; - static const uint8_t UDP = 17; - static const uint8_t IDP = 22; - static const uint8_t ND = 77; - static const uint8_t RAW = 255; -}; - -class W5100Class { - - public: - void init(); - - /** - * @brief This function is being used for copy the data form Receive buffer of the chip to application buffer. - * - * It calculate the actual physical address where one has to read - * the data from Receive buffer. Here also take care of the condition while it exceed - * the Rx memory uper-bound of socket. - */ - void read_data(SOCKET s, - volatile uint8_t * src, - volatile uint8_t * dst, - uint16_t len); - - /** - * @brief This function is being called by send() and sendto() function also. - * - * This function read the Tx write pointer register and after copy the data in buffer update the Tx write pointer - * register. User should read upper byte first and lower byte later to get proper value. - */ - void send_data_processing(SOCKET s, - const uint8_t * data, - uint16_t len); - /** - * @brief A copy of send_data_processing that uses the provided ptr for the - * write offset. Only needed for the "streaming" UDP API, where - * a single UDP packet is built up over a number of calls to - * send_data_processing_ptr, because TX_WR doesn't seem to get updated - * correctly in those scenarios - * @param ptr value to use in place of TX_WR. If 0, then the value is read - * in from TX_WR - * @return New value for ptr, to be used in the next call - */ -// FIXME Update documentation - void send_data_processing_offset(SOCKET s, - uint16_t data_offset, - const uint8_t * data, - uint16_t len); - - /** - * @brief This function is being called by recv() also. - * - * This function read the Rx read pointer register - * and after copy the data from receive buffer update the Rx write pointer register. - * User should read upper byte first and lower byte later to get proper value. - */ - void recv_data_processing(SOCKET s, - uint8_t * data, - uint16_t len, - uint8_t peek = 0); - - inline void setGatewayIp(uint8_t * _addr); - inline void getGatewayIp(uint8_t * _addr); - - inline void setSubnetMask(uint8_t * _addr); - inline void getSubnetMask(uint8_t * _addr); - - inline void setMACAddress(uint8_t * addr); - inline void getMACAddress(uint8_t * addr); - - inline void setIPAddress(uint8_t * addr); - inline void getIPAddress(uint8_t * addr); - - inline void setRetransmissionTime(uint16_t timeout); - inline void setRetransmissionCount(uint8_t _retry); - - void execCmdSn(SOCKET s, - SockCMD _cmd); - - uint16_t getTXFreeSize(SOCKET s); - uint16_t getRXReceivedSize(SOCKET s); - - - // W5100 Registers - // --------------- - private: - static uint8_t write(uint16_t _addr, - uint8_t _data); - static uint16_t write(uint16_t addr, - const uint8_t * buf, - uint16_t len); - static uint8_t read(uint16_t addr); - static uint16_t read(uint16_t addr, - uint8_t * buf, - uint16_t len); - -#define __GP_REGISTER8(name, address) \ - static inline void write##name(uint8_t _data) { \ - write(address, _data); \ - } \ - static inline uint8_t read##name() { \ - return read(address); \ - } -#define __GP_REGISTER16(name, address) \ - static void write##name(uint16_t _data) { \ - write(address, _data >> 8); \ - write(address+1, _data & 0xFF); \ - } \ - static uint16_t read##name() { \ - uint16_t res = read(address); \ - res = (res << 8) + read(address + 1); \ - return res; \ - } -#define __GP_REGISTER_N(name, address, size) \ - static uint16_t write##name(uint8_t *_buff) { \ - return write(address, _buff, size); \ - } \ - static uint16_t read##name(uint8_t *_buff) { \ - return read(address, _buff, size); \ - } - - public: - __GP_REGISTER8(MR, - 0x0000); // Mode - __GP_REGISTER_N(GAR, - 0x0001, - 4); // Gateway IP address - __GP_REGISTER_N(SUBR, - 0x0005, - 4); // Subnet mask address - __GP_REGISTER_N(SHAR, - 0x0009, - 6); // Source MAC address - __GP_REGISTER_N(SIPR, - 0x000F, - 4); // Source IP address - __GP_REGISTER8(IR, - 0x0015); // Interrupt - __GP_REGISTER8(IMR, - 0x0016); // Interrupt Mask - __GP_REGISTER16(RTR, - 0x0017); // Timeout address - __GP_REGISTER8(RCR, - 0x0019); // Retry count - __GP_REGISTER8(RMSR, - 0x001A); // Receive memory size - __GP_REGISTER8(TMSR, - 0x001B); // Transmit memory size - __GP_REGISTER8(PATR, - 0x001C); // Authentication type address in PPPoE mode - __GP_REGISTER8(PTIMER, - 0x0028); // PPP LCP Request Timer - __GP_REGISTER8(PMAGIC, - 0x0029); // PPP LCP Magic Number - __GP_REGISTER_N(UIPR, - 0x002A, - 4); // Unreachable IP address in UDP mode - __GP_REGISTER16(UPORT, - 0x002E); // Unreachable Port address in UDP mode - -#undef __GP_REGISTER8 -#undef __GP_REGISTER16 -#undef __GP_REGISTER_N - - // W5100 Socket registers - // ---------------------- - private: - static inline uint8_t readSn(SOCKET _s, - uint16_t _addr); - static inline uint8_t writeSn(SOCKET _s, - uint16_t _addr, - uint8_t _data); - static inline uint16_t readSn(SOCKET _s, - uint16_t _addr, - uint8_t * _buf, - uint16_t len); - static inline uint16_t writeSn(SOCKET _s, - uint16_t _addr, - uint8_t * _buf, - uint16_t len); - - static const uint16_t CH_BASE = 0x0400; - static const uint16_t CH_SIZE = 0x0100; - -#define __SOCKET_REGISTER8(name, address) \ - static inline void write##name(SOCKET _s, uint8_t _data) { \ - writeSn(_s, address, _data); \ - } \ - static inline uint8_t read##name(SOCKET _s) { \ - return readSn(_s, address); \ - } -#define __SOCKET_REGISTER16(name, address) \ - static void write##name(SOCKET _s, uint16_t _data) { \ - writeSn(_s, address, _data >> 8); \ - writeSn(_s, address+1, _data & 0xFF); \ - } \ - static uint16_t read##name(SOCKET _s) { \ - uint16_t res = readSn(_s, address); \ - uint16_t res2 = readSn(_s,address + 1); \ - res = res << 8; \ - res2 = res2 & 0xFF; \ - res = res | res2; \ - return res; \ - } -#define __SOCKET_REGISTER_N(name, address, size) \ - static uint16_t write##name(SOCKET _s, uint8_t *_buff) { \ - return writeSn(_s, address, _buff, size); \ - } \ - static uint16_t read##name(SOCKET _s, uint8_t *_buff) { \ - return readSn(_s, address, _buff, size); \ - } - - public: - __SOCKET_REGISTER8(SnMR, - 0x0000) // Mode - __SOCKET_REGISTER8(SnCR, - 0x0001) // Command - __SOCKET_REGISTER8(SnIR, - 0x0002) // Interrupt - __SOCKET_REGISTER8(SnSR, - 0x0003) // Status - __SOCKET_REGISTER16(SnPORT, - 0x0004) // Source Port - __SOCKET_REGISTER_N(SnDHAR, - 0x0006, - 6) // Destination Hardw Addr - __SOCKET_REGISTER_N(SnDIPR, - 0x000C, - 4) // Destination IP Addr - __SOCKET_REGISTER16(SnDPORT, - 0x0010) // Destination Port - __SOCKET_REGISTER16(SnMSSR, - 0x0012) // Max Segment Size - __SOCKET_REGISTER8(SnPROTO, - 0x0014) // Protocol in IP RAW Mode - __SOCKET_REGISTER8(SnTOS, - 0x0015) // IP TOS - __SOCKET_REGISTER8(SnTTL, - 0x0016) // IP TTL - __SOCKET_REGISTER16(SnTX_FSR, - 0x0020) // TX Free Size - __SOCKET_REGISTER16(SnTX_RD, - 0x0022) // TX Read Pointer - __SOCKET_REGISTER16(SnTX_WR, - 0x0024) // TX Write Pointer - __SOCKET_REGISTER16(SnRX_RSR, - 0x0026) // RX Free Size - __SOCKET_REGISTER16(SnRX_RD, - 0x0028) // RX Read Pointer - __SOCKET_REGISTER16(SnRX_WR, - 0x002A) // RX Write Pointer (supported?) -#undef __SOCKET_REGISTER8 -#undef __SOCKET_REGISTER16 -#undef __SOCKET_REGISTER_N - private: - static const uint8_t RST = 7; // Reset BIT - - static const int SOCKETS = 4; - static const uint16_t SMASK = 0x07FF; // Tx buffer MASK - static const uint16_t RMASK = 0x07FF; // Rx buffer MASK - public: - static const uint16_t SSIZE = 2048; // Max Tx buffer size - private: - static const uint16_t RSIZE = 2048; // Max Rx buffer size - uint16_t SBASE[SOCKETS]; // Tx buffer base address - uint16_t RBASE[SOCKETS]; // Rx buffer base address - - private: -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - inline static void initSS() { - DDRB |= _BV(4); - }; - inline static void setSS() { - PORTB &= ~_BV(4); - }; - inline static void resetSS() { - PORTB |= _BV(4); - }; -#elif defined(__AVR_ATmega32U4__) - inline static void initSS() { - DDRB |= _BV(6); - }; - inline static void setSS() { - PORTB &= ~_BV(6); - }; - inline static void resetSS() { - PORTB |= _BV(6); - }; -#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) - inline static void initSS() { - DDRB |= _BV(0); - }; - inline static void setSS() { - PORTB &= ~_BV(0); - }; - inline static void resetSS() { - PORTB |= _BV(0); - }; -#else - inline static void initSS() { - DDRB |= _BV(2); - }; - inline static void setSS() { - PORTB &= ~_BV(2); - }; - inline static void resetSS() { - PORTB |= _BV(2); - }; -#endif - -}; - -extern W5100Class W5100; - -uint8_t W5100Class::readSn(SOCKET _s, - uint16_t _addr) -{ - return read(CH_BASE + _s * CH_SIZE + _addr); -} - -uint8_t W5100Class::writeSn(SOCKET _s, - uint16_t _addr, - uint8_t _data) -{ - return write(CH_BASE + _s * CH_SIZE + _addr, _data); -} - -uint16_t W5100Class::readSn(SOCKET _s, - uint16_t _addr, - uint8_t * _buf, - uint16_t _len) -{ - return read(CH_BASE + _s * CH_SIZE + _addr, _buf, _len); -} - -uint16_t W5100Class::writeSn(SOCKET _s, - uint16_t _addr, - uint8_t * _buf, - uint16_t _len) -{ - return write(CH_BASE + _s * CH_SIZE + _addr, _buf, _len); -} - -void W5100Class::getGatewayIp(uint8_t * _addr) -{ - readGAR(_addr); -} - -void W5100Class::setGatewayIp(uint8_t * _addr) -{ - writeGAR(_addr); -} - -void W5100Class::getSubnetMask(uint8_t * _addr) -{ - readSUBR(_addr); -} - -void W5100Class::setSubnetMask(uint8_t * _addr) -{ - writeSUBR(_addr); -} - -void W5100Class::getMACAddress(uint8_t * _addr) -{ - readSHAR(_addr); -} - -void W5100Class::setMACAddress(uint8_t * _addr) -{ - writeSHAR(_addr); -} - -void W5100Class::getIPAddress(uint8_t * _addr) -{ - readSIPR(_addr); -} - -void W5100Class::setIPAddress(uint8_t * _addr) -{ - writeSIPR(_addr); -} - -void W5100Class::setRetransmissionTime(uint16_t _timeout) -{ - writeRTR(_timeout); -} - -void W5100Class::setRetransmissionCount(uint8_t _retry) -{ - writeRCR(_retry); -} - -#endif diff --git a/ports/arduino_uno/external/Arduino/Ethernet/include/w5100Wrapper.h b/ports/arduino_uno/external/Arduino/Ethernet/include/w5100Wrapper.h deleted file mode 100644 index ec67ddbb..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/include/w5100Wrapper.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * w5100Wrapper.h - * - * Created on: 26 de Mai de 2013 - * Author: mgf - */ - -#ifndef W5100WRAPPER_H_ -#define W5100WRAPPER_H_ - -#include - -typedef uint8_t SOCKET; -typedef void CSnMR; -typedef void CSnIR; -typedef void CSnSR; -typedef void CIPPROTO; -typedef void CW5100Class; - -#define MAX_SOCK_NUM 4 - -#ifdef __cplusplus -extern "C" { -#endif - - CSnMR *CSnMR_new(); - void CSnMR_delete(const CSnMR * obj); - uint8_t SnMR_CLOSE(); - uint8_t SnMR_UDP(); - uint8_t SnMR_TCP(); - uint8_t SnMR_IPRAW(); - uint8_t SnMR_MACRAW(); - uint8_t SnMR_PPPOE(); - uint8_t SnMR_ND(); - uint8_t SnMR_MULTI(); - - CSnIR *CSnIR_new(); - void CSnIR_delete(const CSnIR * obj); - uint8_t SnIR_SEND_OK(); - uint8_t SnIR_TIMEOUT(); - uint8_t SnIR_RECV(); - uint8_t SnIR_DISCON(); - uint8_t SnIR_CON(); - - - CSnSR *CSnSR_new(); - void CSnSR_delete(const CSnSR * obj); - uint8_t SnSR_CLOSED(); - uint8_t SnSR_INIT(); - uint8_t SnSR_LISTEN(); - uint8_t SnSR_SYNSENT(); - uint8_t SnSR_SYNRECV(); - uint8_t SnSR_ESTABLISHED(); - uint8_t SnSR_FIN_WAIT(); - uint8_t SnSR_CLOSING(); - uint8_t SnSR_TIME_WAIT(); - uint8_t SnSR_CLOSE_WAIT(); - uint8_t SnSR_LAST_ACK(); - uint8_t SnSR_UDP(); - uint8_t SnSR_IPRAW(); - uint8_t SnSR_MACRAW(); - uint8_t SnSR_PPPOE(); - - CIPPROTO *CIPPROTO_new(); - void CIPPROTO_delete(const CIPPROTO * obj); - uint8_t IPPROTO_IP(); - uint8_t IPPROTO_ICMP(); - uint8_t IPPROTO_IGMP(); - uint8_t IPPROTO_GGP(); - uint8_t IPPROTO_TCP(); - uint8_t IPPROTO_PUP(); - uint8_t IPPROTO_UDP(); - uint8_t IPPROTO_IDP(); - uint8_t IPPROTO_ND(); - uint8_t IPPROTO_RAW(); - - CW5100Class *CW5100Class_new(); - void init_func(const CW5100Class * obj); - void CW5100Class_delete(const CW5100Class * obj); - - void read_data_func(const CW5100Class * obj, - SOCKET s, - volatile uint8_t * src, - volatile uint8_t * dst, - uint16_t len); - - void send_data_processing_func(const CW5100Class * obj, - SOCKET s, - const uint8_t * data, - uint16_t len); - void send_data_processing_offset_func(const CW5100Class * obj, - SOCKET s, - uint16_t data_offset, - const uint8_t * data, - uint16_t len); -//FIXME: Removed defaul value of 0(zero) from the peek argument - void recv_data_processing_func(const CW5100Class * obj, - SOCKET s, - uint8_t * data, - uint16_t len, - uint8_t peek); - void setGatewayIp_func(const CW5100Class * obj, - uint8_t * _addr); - void getGatewayIp_func(const CW5100Class * obj, - uint8_t * _addr); -// - void setSubnetMask_func(const CW5100Class * obj, - uint8_t * _addr); - void getSubnetMask_func(const CW5100Class * obj, - uint8_t * _addr); -// - void setMACAddress_func(const CW5100Class * obj, - uint8_t * addr); - void getMACAddress_func(const CW5100Class * obj, - uint8_t * addr); -// - void setIPAddress_func(const CW5100Class * obj, - uint8_t * addr); - void getIPAddress_func(const CW5100Class * obj, - uint8_t * addr); -// - void setRetransmissionTime_func(const CW5100Class * obj, - uint16_t timeout); - void setRetransmissionCount_func(const CW5100Class * obj, - uint8_t _retry); -// - - uint16_t getTXFreeSize_func(const CW5100Class * obj, - SOCKET s); - uint16_t getRXReceivedSize_func(const CW5100Class * obj, - SOCKET s); - - uint8_t readSnSR_func(const CW5100Class * obj, - SOCKET s); - -#ifdef __cplusplus -} -#endif -#endif /* W5100WRAPPER_H_ */ diff --git a/ports/arduino_uno/external/Arduino/Ethernet/src/SPI.cpp b/ports/arduino_uno/external/Arduino/Ethernet/src/SPI.cpp deleted file mode 100644 index 0434dd00..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/src/SPI.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2010 by Cristian Maglie - * SPI Master library for arduino. - * - * SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.1-only - */ - -#include "pins_arduino.h" -#include "SPI.h" - -SPIClass SPI; - -void SPIClass::begin() { - - // Set SS to high so a connected chip will be "deselected" by default - digitalWrite(SS, HIGH); - - // When the SS pin is set as OUTPUT, it can be used as - // a general purpose output port (it doesn't influence - // SPI operations). - pinMode(SS, OUTPUT); - - // Warning: if the SS pin ever becomes a LOW INPUT then SPI - // automatically switches to Slave, so the data direction of - // the SS pin MUST be kept as OUTPUT. - SPCR |= _BV(MSTR); - SPCR |= _BV(SPE); - - // Set direction register for SCK and MOSI pin. - // MISO pin automatically overrides to INPUT. - // By doing this AFTER enabling SPI, we avoid accidentally - // clocking in a single bit since the lines go directly - // from "input" to SPI control. - // http://code.google.com/p/arduino/issues/detail?id=888 - pinMode(SCK, OUTPUT); - pinMode(MOSI, OUTPUT); -} - - -void SPIClass::end() { - SPCR &= ~_BV(SPE); -} - -void SPIClass::setBitOrder(uint8_t bitOrder) -{ - if(bitOrder == LSBFIRST) { - SPCR |= _BV(DORD); - } else { - SPCR &= ~(_BV(DORD)); - } -} - -void SPIClass::setDataMode(uint8_t mode) -{ - SPCR = (SPCR & ~SPI_MODE_MASK) | mode; -} - -void SPIClass::setClockDivider(uint8_t rate) -{ - SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK); - SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK); -} - diff --git a/ports/arduino_uno/external/Arduino/Ethernet/src/socket.cpp b/ports/arduino_uno/external/Arduino/Ethernet/src/socket.cpp deleted file mode 100644 index fd3e4426..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/src/socket.cpp +++ /dev/null @@ -1,400 +0,0 @@ -#include "w5100.h" -#include "socket.h" - -static uint16_t local_port; - -/** - * @brief This Socket function initialize the channel in perticular mode, and set the port and wait for W5100 done it. - * @return 1 for success else 0. - */ -uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag) -{ - if ((protocol == SnMR::TCP) || (protocol == SnMR::UDP) || (protocol == SnMR::IPRAW) || (protocol == SnMR::MACRAW) || (protocol == SnMR::PPPOE)) - { - close(s); - W5100.writeSnMR(s, protocol | flag); - if (port != 0) { - W5100.writeSnPORT(s, port); - } - else { - local_port++; // if don't set the source port, set local_port number. - W5100.writeSnPORT(s, local_port); - } - - W5100.execCmdSn(s, Sock_OPEN); - - return 1; - } - - return 0; -} - - -/** - * @brief This function close the socket and parameter is "s" which represent the socket number - */ -void close(SOCKET s) -{ - W5100.execCmdSn(s, Sock_CLOSE); - W5100.writeSnIR(s, 0xFF); -} - - -/** - * @brief This function established the connection for the channel in passive (server) mode. This function waits for the request from the peer. - * @return 1 for success else 0. - */ -uint8_t listen(SOCKET s) -{ - if (W5100.readSnSR(s) != SnSR::INIT) - return 0; - W5100.execCmdSn(s, Sock_LISTEN); - return 1; -} - - -/** - * @brief This function established the connection for the channel in Active (client) mode. - * This function waits for the untill the connection is established. - * - * @return 1 for success else 0. - */ -uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port) -{ - if - ( - ((addr[0] == 0xFF) && (addr[1] == 0xFF) && (addr[2] == 0xFF) && (addr[3] == 0xFF)) || - ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) || - (port == 0x00) - ) - return 0; - - // set destination IP - W5100.writeSnDIPR(s, addr); - W5100.writeSnDPORT(s, port); - W5100.execCmdSn(s, Sock_CONNECT); - - return 1; -} - - - -/** - * @brief This function used for disconnect the socket and parameter is "s" which represent the socket number - * @return 1 for success else 0. - */ -void disconnect(SOCKET s) -{ - W5100.execCmdSn(s, Sock_DISCON); -} - - -/** - * @brief This function used to send the data in TCP mode - * @return 1 for success else 0. - */ -uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len) -{ - uint8_t status=0; - uint16_t ret=0; - uint16_t freesize=0; - - if (len > W5100.SSIZE) - ret = W5100.SSIZE; // check size not to exceed MAX size. - else - ret = len; - - // if freebuf is available, start. - do - { - freesize = W5100.getTXFreeSize(s); - status = W5100.readSnSR(s); - if ((status != SnSR::ESTABLISHED) && (status != SnSR::CLOSE_WAIT)) - { - ret = 0; - break; - } - } - while (freesize < ret); - - // copy data - W5100.send_data_processing(s, (uint8_t *)buf, ret); - W5100.execCmdSn(s, Sock_SEND); - - /* +2008.01 bj */ - while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK ) - { - /* m2008.01 [bj] : reduce code */ - if ( W5100.readSnSR(s) == SnSR::CLOSED ) - { - close(s); - return 0; - } - } - /* +2008.01 bj */ - W5100.writeSnIR(s, SnIR::SEND_OK); - return ret; -} - - -/** - * @brief This function is an application I/F function which is used to receive the data in TCP mode. - * It continues to wait for data as much as the application wants to receive. - * - * @return received data size for success else -1. - */ -int16_t recv(SOCKET s, uint8_t *buf, int16_t len) -{ - // Check how much data is available - int16_t ret = W5100.getRXReceivedSize(s); - if ( ret == 0 ) - { - // No data available. - uint8_t status = W5100.readSnSR(s); - if ( status == SnSR::LISTEN || status == SnSR::CLOSED || status == SnSR::CLOSE_WAIT ) - { - // The remote end has closed its side of the connection, so this is the eof state - ret = 0; - } - else - { - // The connection is still up, but there's no data waiting to be read - ret = -1; - } - } - else if (ret > len) - { - ret = len; - } - - if ( ret > 0 ) - { - W5100.recv_data_processing(s, buf, ret); - W5100.execCmdSn(s, Sock_RECV); - } - return ret; -} - - -/** - * @brief Returns the first byte in the receive queue (no checking) - * - * @return - */ -uint16_t peek(SOCKET s, uint8_t *buf) -{ - W5100.recv_data_processing(s, buf, 1, 1); - - return 1; -} - - -/** - * @brief This function is an application I/F function which is used to send the data for other then TCP mode. - * Unlike TCP transmission, The peer's destination address and the port is needed. - * - * @return This function return send data size for success else -1. - */ -uint16_t sendto(SOCKET s, const uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t port) -{ - uint16_t ret=0; - - if (len > W5100.SSIZE) ret = W5100.SSIZE; // check size not to exceed MAX size. - else ret = len; - - if - ( - ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) || - ((port == 0x00)) ||(ret == 0) - ) - { - /* +2008.01 [bj] : added return value */ - ret = 0; - } - else - { - W5100.writeSnDIPR(s, addr); - W5100.writeSnDPORT(s, port); - - // copy data - W5100.send_data_processing(s, (uint8_t *)buf, ret); - W5100.execCmdSn(s, Sock_SEND); - - /* +2008.01 bj */ - while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK ) - { - if (W5100.readSnIR(s) & SnIR::TIMEOUT) - { - /* +2008.01 [bj]: clear interrupt */ - W5100.writeSnIR(s, (SnIR::SEND_OK | SnIR::TIMEOUT)); /* clear SEND_OK & TIMEOUT */ - return 0; - } - } - - /* +2008.01 bj */ - W5100.writeSnIR(s, SnIR::SEND_OK); - } - return ret; -} - - -/** - * @brief This function is an application I/F function which is used to receive the data in other then - * TCP mode. This function is used to receive UDP, IP_RAW and MAC_RAW mode, and handle the header as well. - * - * @return This function return received data size for success else -1. - */ -uint16_t recvfrom(SOCKET s, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t *port) -{ - uint8_t head[8]; - uint16_t data_len=0; - uint16_t ptr=0; - - if ( len > 0 ) - { - ptr = W5100.readSnRX_RD(s); - switch (W5100.readSnMR(s) & 0x07) - { - case SnMR::UDP : - W5100.read_data(s, (uint8_t *)ptr, head, 0x08); - ptr += 8; - // read peer's IP address, port number. - addr[0] = head[0]; - addr[1] = head[1]; - addr[2] = head[2]; - addr[3] = head[3]; - *port = head[4]; - *port = (*port << 8) + head[5]; - data_len = head[6]; - data_len = (data_len << 8) + head[7]; - - W5100.read_data(s, (uint8_t *)ptr, buf, data_len); // data copy. - ptr += data_len; - - W5100.writeSnRX_RD(s, ptr); - break; - - case SnMR::IPRAW : - W5100.read_data(s, (uint8_t *)ptr, head, 0x06); - ptr += 6; - - addr[0] = head[0]; - addr[1] = head[1]; - addr[2] = head[2]; - addr[3] = head[3]; - data_len = head[4]; - data_len = (data_len << 8) + head[5]; - - W5100.read_data(s, (uint8_t *)ptr, buf, data_len); // data copy. - ptr += data_len; - - W5100.writeSnRX_RD(s, ptr); - break; - - case SnMR::MACRAW: - W5100.read_data(s,(uint8_t*)ptr,head,2); - ptr+=2; - data_len = head[0]; - data_len = (data_len<<8) + head[1] - 2; - - W5100.read_data(s,(uint8_t*) ptr,buf,data_len); - ptr += data_len; - W5100.writeSnRX_RD(s, ptr); - break; - - default : - break; - } - W5100.execCmdSn(s, Sock_RECV); - } - return data_len; -} - - -uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len) -{ - uint8_t status=0; - uint16_t ret=0; - - if (len > W5100.SSIZE) - ret = W5100.SSIZE; // check size not to exceed MAX size. - else - ret = len; - - if (ret == 0) - return 0; - - W5100.send_data_processing(s, (uint8_t *)buf, ret); - W5100.execCmdSn(s, Sock_SEND); - - while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK ) - { - status = W5100.readSnSR(s); - if (W5100.readSnIR(s) & SnIR::TIMEOUT) - { - /* in case of igmp, if send fails, then socket closed */ - /* if you want change, remove this code. */ - close(s); - return 0; - } - } - - W5100.writeSnIR(s, SnIR::SEND_OK); - return ret; -} - -uint16_t bufferData(SOCKET s, uint16_t offset, const uint8_t* buf, uint16_t len) -{ - uint16_t ret =0; - if (len > W5100.getTXFreeSize(s)) - { - ret = W5100.getTXFreeSize(s); // check size not to exceed MAX size. - } - else - { - ret = len; - } - W5100.send_data_processing_offset(s, offset, buf, ret); - return ret; -} - -int startUDP(SOCKET s, uint8_t* addr, uint16_t port) -{ - if - ( - ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) || - ((port == 0x00)) - ) - { - return 0; - } - else - { - W5100.writeSnDIPR(s, addr); - W5100.writeSnDPORT(s, port); - return 1; - } -} - -int sendUDP(SOCKET s) -{ - W5100.execCmdSn(s, Sock_SEND); - - /* +2008.01 bj */ - while ( (W5100.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK ) - { - if (W5100.readSnIR(s) & SnIR::TIMEOUT) - { - /* +2008.01 [bj]: clear interrupt */ - W5100.writeSnIR(s, (SnIR::SEND_OK|SnIR::TIMEOUT)); - return 0; - } - } - - /* +2008.01 bj */ - W5100.writeSnIR(s, SnIR::SEND_OK); - - /* Sent ok */ - return 1; -} - diff --git a/ports/arduino_uno/external/Arduino/Ethernet/src/w5100.cpp b/ports/arduino_uno/external/Arduino/Ethernet/src/w5100.cpp deleted file mode 100644 index 9cbe9350..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/src/w5100.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2010 by Cristian Maglie - * - * SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.1-only - */ - -#include -#include -#include - -#include "w5100.h" - -// W5100 controller instance -W5100Class W5100; - -#define TX_RX_MAX_BUF_SIZE 2048 -#define TX_BUF 0x1100 -#define RX_BUF (TX_BUF + TX_RX_MAX_BUF_SIZE) - -#define TXBUF_BASE 0x4000 -#define RXBUF_BASE 0x6000 - -void W5100Class::init(void) -{ - delay(300); - - SPI.begin(); - initSS(); - - writeMR(1< SSIZE) - { - // Wrap around circular buffer - uint16_t size = SSIZE - offset; - write(dstAddr, data, size); - write(SBASE[s], data + size, len - size); - } - else { - write(dstAddr, data, len); - } - - ptr += len; - writeSnTX_WR(s, ptr); -} - - -void W5100Class::recv_data_processing(SOCKET s, uint8_t *data, uint16_t len, uint8_t peek) -{ - uint16_t ptr; - ptr = readSnRX_RD(s); - read_data(s, (uint8_t *)ptr, data, len); - if (!peek) - { - ptr += len; - writeSnRX_RD(s, ptr); - } -} - -void W5100Class::read_data(SOCKET s, volatile uint8_t *src, volatile uint8_t *dst, uint16_t len) -{ - uint16_t size; - uint16_t src_mask; - uint16_t src_ptr; - - src_mask = (uint16_t)src & RMASK; - src_ptr = RBASE[s] + src_mask; - - if( (src_mask + len) > RSIZE ) - { - size = RSIZE - src_mask; - read(src_ptr, (uint8_t *)dst, size); - dst += size; - read(RBASE[s], (uint8_t *) dst, len - size); - } - else - read(src_ptr, (uint8_t *) dst, len); -} - - -uint8_t W5100Class::write(uint16_t _addr, uint8_t _data) -{ - setSS(); - SPI.transfer(0xF0); - SPI.transfer(_addr >> 8); - SPI.transfer(_addr & 0xFF); - SPI.transfer(_data); - resetSS(); - return 1; -} - -uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len) -{ - for (uint16_t i=0; i<_len; i++) - { - setSS(); - SPI.transfer(0xF0); - SPI.transfer(_addr >> 8); - SPI.transfer(_addr & 0xFF); - _addr++; - SPI.transfer(_buf[i]); - resetSS(); - } - return _len; -} - -uint8_t W5100Class::read(uint16_t _addr) -{ - setSS(); - SPI.transfer(0x0F); - SPI.transfer(_addr >> 8); - SPI.transfer(_addr & 0xFF); - uint8_t _data = SPI.transfer(0); - resetSS(); - return _data; -} - -uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len) -{ - for (uint16_t i=0; i<_len; i++) - { - setSS(); - SPI.transfer(0x0F); - SPI.transfer(_addr >> 8); - SPI.transfer(_addr & 0xFF); - _addr++; - _buf[i] = SPI.transfer(0); - resetSS(); - } - return _len; -} - -void W5100Class::execCmdSn(SOCKET s, SockCMD _cmd) { - // Send command to socket - writeSnCR(s, _cmd); - // Wait for command to complete - while (readSnCR(s)) - ; -} diff --git a/ports/arduino_uno/external/Arduino/Ethernet/src/w5100Wrapper.cpp b/ports/arduino_uno/external/Arduino/Ethernet/src/w5100Wrapper.cpp deleted file mode 100644 index 0022e654..00000000 --- a/ports/arduino_uno/external/Arduino/Ethernet/src/w5100Wrapper.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * w5100Wrapper.cpp - * - * Created on: 26 de Mai de 2013 - * Author: mgf - */ - - -#include "w5100.h" -#include "w5100Wrapper.h" - -extern "C"{ - -CSnMR * CSnMR_new(){ - SnMR* s = new SnMR(); - return (CSnMR*)s; -} -void CSnMR_delete(const CSnMR* obj){ - SnMR* s = (SnMR*)obj; - delete s; -} -uint8_t SnMR_CLOSE(){ return SnMR::CLOSE; } -uint8_t SnMR_UDP(){ return SnMR::UDP; } -uint8_t SnMR_TCP(){ return SnMR::TCP; } -uint8_t SnMR_IPRAW(){ return SnMR::IPRAW; } -uint8_t SnMR_MACRAW(){ return SnMR::MACRAW; } -uint8_t SnMR_PPPOE(){ return SnMR::PPPOE; } -uint8_t SnMR_ND(){ return SnMR::ND; } -uint8_t SnMR_MULTI(){ return SnMR::MULTI; } - -CSnIR * CSnIR_new(){ - SnIR* s = new SnIR(); - return (CSnIR*) s; -} -void CSnIR_delete(const CSnIR* obj){ - SnIR* s = (SnIR*)obj; - delete s; -} -uint8_t SnIR_SEND_OK(){ return SnIR::SEND_OK; } -uint8_t SnIR_TIMEOUT(){ return SnIR::TIMEOUT; } -uint8_t SnIR_RECV(){ return SnIR::RECV; } -uint8_t SnIR_DISCON(){ return SnIR::DISCON; } -uint8_t SnIR_CON(){ return SnIR::CON; } - -CSnSR * CSnSR_new(){ - SnSR* s = new SnSR(); - return (CSnSR*) s; -} -void CSnSR_delete(const CSnSR* obj){ - SnSR* s = (SnSR*)obj; - delete s; -} -uint8_t SnSR_CLOSED(){ return SnSR::CLOSED; } -uint8_t SnSR_INIT(){ return SnSR::INIT; } -uint8_t SnSR_LISTEN(){ return SnSR::LISTEN; } -uint8_t SnSR_SYNSENT(){ return SnSR::SYNSENT; } -uint8_t SnSR_SYNRECV(){ return SnSR::SYNRECV; } -uint8_t SnSR_ESTABLISHED(){ return SnSR::ESTABLISHED; } -uint8_t SnSR_FIN_WAIT(){ return SnSR::FIN_WAIT; } -uint8_t SnSR_CLOSING(){ return SnSR::CLOSING; } -uint8_t SnSR_TIME_WAIT(){ return SnSR::TIME_WAIT; } -uint8_t SnSR_CLOSE_WAIT(){ return SnSR::CLOSE_WAIT; } -uint8_t SnSR_LAST_ACK(){ return SnSR::LAST_ACK; } -uint8_t SnSR_UDP(){ return SnSR::UDP; } -uint8_t SnSR_IPRAW(){ return SnSR::IPRAW; } -uint8_t SnSR_MACRAW(){ return SnSR::MACRAW; } -uint8_t SnSR_PPPOE(){ return SnSR::PPPOE; } - -CIPPROTO * CIPPROTO_new(){ - IPPROTO* i = new IPPROTO(); - return (CIPPROTO*) i; -} -void CIPPROTO_delete(const CIPPROTO* obj){ - IPPROTO* i = (IPPROTO*) obj; - delete i; -} -uint8_t IPPROTO_IP(){ return IPPROTO::IP; } -uint8_t IPPROTO_ICMP(){ return IPPROTO::ICMP; } -uint8_t IPPROTO_IGMP(){ return IPPROTO::IGMP; } -uint8_t IPPROTO_GGP(){ return IPPROTO::GGP; } -uint8_t IPPROTO_TCP(){ return IPPROTO::TCP; } -uint8_t IPPROTO_PUP(){ return IPPROTO::PUP; } -uint8_t IPPROTO_UDP(){ return IPPROTO::UDP; } -uint8_t IPPROTO_IDP(){ return IPPROTO::IDP; } -uint8_t IPPROTO_ND(){ return IPPROTO::ND; } -uint8_t IPPROTO_RAW(){ return IPPROTO::RAW; } - -CW5100Class * CW5100Class_new(){ - return (CW5100Class*) &W5100; -} - -void init_func(const CW5100Class * obj){ - W5100Class* w = (W5100Class*) obj; - w->init(); -} - -void read_data_func(const CW5100Class * obj, SOCKET s, volatile uint8_t * src, volatile uint8_t * dst, - uint16_t len){ - W5100Class* w = (W5100Class*) obj; - w->read_data(s, src, dst, len); -} - -void send_data_processing_func(const CW5100Class * obj, SOCKET s, const uint8_t *data, uint16_t len){ - W5100Class* w = (W5100Class*) obj; - w->send_data_processing(s, data, len); -} -void send_data_processing_offset_func(const CW5100Class * obj, SOCKET s, uint16_t data_offset, - const uint8_t *data, uint16_t len){ - W5100Class* w = (W5100Class*) obj; - w->send_data_processing_offset(s, data_offset, data, len); -} -//FIXME: Removed defaul value of 0(zero) from the peek argument -void recv_data_processing_func(const CW5100Class * obj, SOCKET s, uint8_t *data, uint16_t len, - uint8_t peek){ - W5100Class* w = (W5100Class*) obj; - w->recv_data_processing(s, data, len, peek); -} -void setGatewayIp_func(const CW5100Class * obj, uint8_t *_addr){ - W5100Class* w = (W5100Class*) obj; - w->setGatewayIp(_addr); -} -void getGatewayIp_func(const CW5100Class * obj, uint8_t *_addr){ - W5100Class* w = (W5100Class*) obj; - w->getGatewayIp(_addr); -} - -void setSubnetMask_func(const CW5100Class * obj, uint8_t *_addr){ - W5100Class* w = (W5100Class*) obj; - w->setSubnetMask(_addr); -} -void getSubnetMask_func(const CW5100Class * obj, uint8_t *_addr){ - W5100Class* w = (W5100Class*) obj; - w->getSubnetMask(_addr); -} - -void setMACAddress_func(const CW5100Class * obj, uint8_t * addr){ - W5100Class* w = (W5100Class*) obj; - w->setMACAddress(addr); -} -void getMACAddress_func(const CW5100Class * obj, uint8_t * addr){ - W5100Class* w = (W5100Class*) obj; - w->getMACAddress(addr); -} -void setIPAddress_func(const CW5100Class * obj, uint8_t * addr){ - W5100Class* w = (W5100Class*) obj; - w->setIPAddress(addr); -} -void getIPAddress_func(const CW5100Class * obj, uint8_t * addr){ - W5100Class* w = (W5100Class*) obj; - w->getIPAddress(addr); -} -void setRetransmissionTime_func(const CW5100Class * obj, uint16_t timeout){ - W5100Class* w = (W5100Class*) obj; - w->setRetransmissionTime(timeout); -} -void setRetransmissionCount_func(const CW5100Class * obj, uint8_t _retry){ - W5100Class* w = (W5100Class*) obj; - w->setRetransmissionCount(_retry); -} - -uint16_t getTXFreeSize_func(const CW5100Class * obj,SOCKET s){ - W5100Class* w = (W5100Class*) obj; - return w->getTXFreeSize(s); -} -uint16_t getRXReceivedSize_func(const CW5100Class * obj,SOCKET s){ - W5100Class* w = (W5100Class*) obj; - return w->getRXReceivedSize(s); -} - -uint8_t readSnSR_func(const CW5100Class* obj, SOCKET s){ - W5100Class* w = (W5100Class*) obj; - return w->readSnSR(s); -} - -}//externC - diff --git a/ports/arduino_uno/external/Arduino/core/include/Arduino.h b/ports/arduino_uno/external/Arduino/core/include/Arduino.h deleted file mode 100644 index 0c0b726f..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/Arduino.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef Arduino_h -#define Arduino_h - -#include -#include -#include - -#include -#include -#include - -#include "binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define HIGH 0x1 -#define LOW 0x0 - -#define INPUT 0x0 -#define OUTPUT 0x1 -#define INPUT_PULLUP 0x2 - -#define true 0x1 -#define false 0x0 - -#define PI 3.1415926535897932384626433832795 -#define HALF_PI 1.5707963267948966192313216916398 -#define TWO_PI 6.283185307179586476925286766559 -#define DEG_TO_RAD 0.017453292519943295769236907684886 -#define RAD_TO_DEG 57.295779513082320876798154814105 - -#define SERIAL 0x0 -#define DISPLAY 0x1 - -#define LSBFIRST 0 -#define MSBFIRST 1 - -#define CHANGE 1 -#define FALLING 2 -#define RISING 3 - -#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) -#define DEFAULT 0 -#define EXTERNAL 1 -#define INTERNAL 2 -#else -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) -#define INTERNAL1V1 2 -#define INTERNAL2V56 3 -#else -#define INTERNAL 3 -#endif -#define DEFAULT 1 -#define EXTERNAL 0 -#endif - -// undefine stdlib's abs if encountered -#ifdef abs -#undef abs -#endif - -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) -#define abs(x) ((x)>0?(x):-(x)) -#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) -#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) -#define radians(deg) ((deg)*DEG_TO_RAD) -#define degrees(rad) ((rad)*RAD_TO_DEG) -#define sq(x) ((x)*(x)) - -#define interrupts() sei() -#define noInterrupts() cli() - -#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) -#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) -#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) - -#define lowByte(w) ((uint8_t) ((w) & 0xff)) -#define highByte(w) ((uint8_t) ((w) >> 8)) - -#define bitRead(value, bit) (((value) >> (bit)) & 0x01) -#define bitSet(value, bit) ((value) |= (1UL << (bit))) -#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) - - - typedef unsigned int word; - -#define bit(b) (1UL << (b)) - - typedef uint8_t boolean; - typedef uint8_t byte; - - void init(void); - - void pinMode(uint8_t, - uint8_t); - void digitalWrite(uint8_t, - uint8_t); - int digitalRead(uint8_t); - int analogRead(uint8_t); - void analogReference(uint8_t mode); - void analogWrite(uint8_t, - int); - - unsigned long millis(void); - unsigned long micros(void); - void delay(unsigned long); - void delayMicroseconds(unsigned int us); - unsigned long pulseIn(uint8_t pin, - uint8_t state, - unsigned long timeout); - - void shiftOut(uint8_t dataPin, - uint8_t clockPin, - uint8_t bitOrder, - uint8_t val); - uint8_t shiftIn(uint8_t dataPin, - uint8_t clockPin, - uint8_t bitOrder); - - void attachInterrupt(uint8_t, - void (*)(void), - int mode); - void detachInterrupt(uint8_t); - - void setup(void); - void loop(void); - -// Get the bit location within the hardware port of the given virtual pin. -// This comes from the pins_*.c file for the active board configuration. - -#define analogInPinToBit(P) (P) - -// On the ATmega1280, the addresses of some of the port registers are -// greater than 255, so we can't store them in uint8_t's. - extern const uint16_t PROGMEM port_to_mode_PGM[]; - extern const uint16_t PROGMEM port_to_input_PGM[]; - extern const uint16_t PROGMEM port_to_output_PGM[]; - - extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; -// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; - extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; - extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; - -// Get the bit location within the hardware port of the given virtual pin. -// This comes from the pins_*.c file for the active board configuration. -// -// These perform slightly better as macros compared to inline functions -// -#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) -#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) -#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) -#define analogInPinToBit(P) (P) -#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) ) -#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) ) -#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) ) - -#define NOT_A_PIN 0 -#define NOT_A_PORT 0 - -#ifdef ARDUINO_MAIN -#define PA 1 -#define PB 2 -#define PC 3 -#define PD 4 -#define PE 5 -#define PF 6 -#define PG 7 -#define PH 8 -#define PJ 10 -#define PK 11 -#define PL 12 -#endif - -#define NOT_ON_TIMER 0 -#define TIMER0A 1 -#define TIMER0B 2 -#define TIMER1A 3 -#define TIMER1B 4 -#define TIMER2 5 -#define TIMER2A 6 -#define TIMER2B 7 - -#define TIMER3A 8 -#define TIMER3B 9 -#define TIMER3C 10 -#define TIMER4A 11 -#define TIMER4B 12 -#define TIMER4C 13 -#define TIMER4D 14 -#define TIMER5A 15 -#define TIMER5B 16 -#define TIMER5C 17 - -#ifdef __cplusplus -} // extern "C" -#endif -#ifdef __cplusplus -#include "WCharacter.h" -#include "WString.h" -#include "HardwareSerial.h" -uint16_t makeWord(uint16_t w); -uint16_t makeWord(byte h, - byte l); - -#define word(...) makeWord(__VA_ARGS__) - -unsigned long pulseIn(uint8_t pin, - uint8_t state, - unsigned long timeout = 1000000L); - -void tone(uint8_t _pin, - unsigned int frequency, - unsigned long duration = 0); -void noTone(uint8_t _pin); - -// WMath prototypes -long random(long); -long random(long, - long); -void randomSeed(unsigned int); -long map(long, - long, - long, - long, - long); - -#endif - -#include "pins_arduino.h" - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/HardwareSerial.h b/ports/arduino_uno/external/Arduino/core/include/HardwareSerial.h deleted file mode 100644 index 03b31e0a..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/HardwareSerial.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - HardwareSerial.h - Hardware serial library for Wiring - Copyright (c) 2006 Nicholas Zambetti. All right reserved. - Modified 28 September 2010 by Mark Sproul - Modified 14 August 2012 by Alarus - - SPDX-License-Identifier: LGPL-2.1-or-later -*/ - -#ifndef HardwareSerial_h -#define HardwareSerial_h - -#include - -#include "Stream.h" - -struct ring_buffer; - -class HardwareSerial:public Stream { - private: - ring_buffer * _rx_buffer; - ring_buffer *_tx_buffer; - volatile uint8_t *_ubrrh; - volatile uint8_t *_ubrrl; - volatile uint8_t *_ucsra; - volatile uint8_t *_ucsrb; - volatile uint8_t *_ucsrc; - volatile uint8_t *_udr; - uint8_t _rxen; - uint8_t _txen; - uint8_t _rxcie; - uint8_t _udrie; - uint8_t _u2x; - bool transmitting; - public: - HardwareSerial(ring_buffer * rx_buffer, - ring_buffer * tx_buffer, - volatile uint8_t * ubrrh, - volatile uint8_t * ubrrl, - volatile uint8_t * ucsra, - volatile uint8_t * ucsrb, - volatile uint8_t * ucsrc, - volatile uint8_t * udr, - uint8_t rxen, - uint8_t txen, - uint8_t rxcie, - uint8_t udrie, - uint8_t u2x); - void begin(unsigned long); - void begin(unsigned long, - uint8_t); - void end(); - virtual int available(void); - virtual int peek(void); - virtual int read(void); - virtual void flush(void); - virtual size_t write(uint8_t); - inline size_t write(unsigned long n) { - return write((uint8_t) n); - } inline size_t write(long n) { - return write((uint8_t) n); - } - inline size_t write(unsigned int n) { - return write((uint8_t) n); - } - inline size_t write(int n) { - return write((uint8_t) n); - } - using Print::write; // pull in write(str) and write(buf, size) from Print - operator bool(); -}; - -// Define config for Serial.begin(baud, config); -#define SERIAL_5N1 0x00 -#define SERIAL_6N1 0x02 -#define SERIAL_7N1 0x04 -#define SERIAL_8N1 0x06 -#define SERIAL_5N2 0x08 -#define SERIAL_6N2 0x0A -#define SERIAL_7N2 0x0C -#define SERIAL_8N2 0x0E -#define SERIAL_5E1 0x20 -#define SERIAL_6E1 0x22 -#define SERIAL_7E1 0x24 -#define SERIAL_8E1 0x26 -#define SERIAL_5E2 0x28 -#define SERIAL_6E2 0x2A -#define SERIAL_7E2 0x2C -#define SERIAL_8E2 0x2E -#define SERIAL_5O1 0x30 -#define SERIAL_6O1 0x32 -#define SERIAL_7O1 0x34 -#define SERIAL_8O1 0x36 -#define SERIAL_5O2 0x38 -#define SERIAL_6O2 0x3A -#define SERIAL_7O2 0x3C -#define SERIAL_8O2 0x3E - -#if defined(UBRRH) || defined(UBRR0H) -extern HardwareSerial Serial; -#elif defined(USBCON) -#include "USBAPI.h" -// extern HardwareSerial Serial_; -#endif -#if defined(UBRR1H) -extern HardwareSerial Serial1; -#endif -#if defined(UBRR2H) -extern HardwareSerial Serial2; -#endif -#if defined(UBRR3H) -extern HardwareSerial Serial3; -#endif - -extern void serialEventRun(void) __attribute__ ((weak)); - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/Server.h b/ports/arduino_uno/external/Arduino/core/include/Server.h deleted file mode 100644 index 8a11607f..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/Server.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef server_h -#define server_h - -class Server:public Print { - public: - virtual void begin() = 0; -}; - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/USBAPI.h b/ports/arduino_uno/external/Arduino/core/include/USBAPI.h deleted file mode 100644 index 38f2370c..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/USBAPI.h +++ /dev/null @@ -1,202 +0,0 @@ - - -#ifndef __USBAPI__ -#define __USBAPI__ - -#if defined(USBCON) - -//================================================================================ -//================================================================================ -// USB - -class USBDevice_ { - public: - USBDevice_(); - bool configured(); - - void attach(); - void detach(); // Serial port goes down too... - void poll(); -}; -extern USBDevice_ USBDevice; - -//================================================================================ -//================================================================================ -// Serial over CDC (Serial1 is the physical port) - -class Serial_:public Stream { - private: - ring_buffer * _cdc_rx_buffer; - public: - void begin(uint16_t baud_count); - void end(void); - - virtual int available(void); - virtual void accept(void); - virtual int peek(void); - virtual int read(void); - virtual void flush(void); - virtual size_t write(uint8_t); - using Print::write; // pull in write(str) and write(buf, size) from Print - operator bool(); -}; -extern Serial_ Serial; - -//================================================================================ -//================================================================================ -// Mouse - -#define MOUSE_LEFT 1 -#define MOUSE_RIGHT 2 -#define MOUSE_MIDDLE 4 -#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE) - -class Mouse_ { - private: - uint8_t _buttons; - void buttons(uint8_t b); - public: - Mouse_(void); - void begin(void); - void end(void); - void click(uint8_t b = MOUSE_LEFT); - void move(signed char x, - signed char y, - signed char wheel = 0); - void press(uint8_t b = MOUSE_LEFT); // press LEFT by default - void release(uint8_t b = MOUSE_LEFT); // release LEFT by default - bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default -}; -extern Mouse_ Mouse; - -//================================================================================ -//================================================================================ -// Keyboard - -#define KEY_LEFT_CTRL 0x80 -#define KEY_LEFT_SHIFT 0x81 -#define KEY_LEFT_ALT 0x82 -#define KEY_LEFT_GUI 0x83 -#define KEY_RIGHT_CTRL 0x84 -#define KEY_RIGHT_SHIFT 0x85 -#define KEY_RIGHT_ALT 0x86 -#define KEY_RIGHT_GUI 0x87 - -#define KEY_UP_ARROW 0xDA -#define KEY_DOWN_ARROW 0xD9 -#define KEY_LEFT_ARROW 0xD8 -#define KEY_RIGHT_ARROW 0xD7 -#define KEY_BACKSPACE 0xB2 -#define KEY_TAB 0xB3 -#define KEY_RETURN 0xB0 -#define KEY_ESC 0xB1 -#define KEY_INSERT 0xD1 -#define KEY_DELETE 0xD4 -#define KEY_PAGE_UP 0xD3 -#define KEY_PAGE_DOWN 0xD6 -#define KEY_HOME 0xD2 -#define KEY_END 0xD5 -#define KEY_CAPS_LOCK 0xC1 -#define KEY_F1 0xC2 -#define KEY_F2 0xC3 -#define KEY_F3 0xC4 -#define KEY_F4 0xC5 -#define KEY_F5 0xC6 -#define KEY_F6 0xC7 -#define KEY_F7 0xC8 -#define KEY_F8 0xC9 -#define KEY_F9 0xCA -#define KEY_F10 0xCB -#define KEY_F11 0xCC -#define KEY_F12 0xCD - -// Low level key report: up to 6 keys and shift, ctrl etc at once -typedef struct { - uint8_t modifiers; - uint8_t reserved; - uint8_t keys[6]; -} KeyReport; - -class Keyboard_:public Print { - private: - KeyReport _keyReport; - void sendReport(KeyReport * keys); - public: - Keyboard_(void); - void begin(void); - void end(void); - virtual size_t write(uint8_t k); - virtual size_t press(uint8_t k); - virtual size_t release(uint8_t k); - virtual void releaseAll(void); -}; -extern Keyboard_ Keyboard; - -//================================================================================ -//================================================================================ -// Low level API - -typedef struct { - uint8_t bmRequestType; - uint8_t bRequest; - uint8_t wValueL; - uint8_t wValueH; - uint16_t wIndex; - uint16_t wLength; -} Setup; - -//================================================================================ -//================================================================================ -// HID 'Driver' - -int HID_GetInterface(uint8_t * interfaceNum); -int HID_GetDescriptor(int i); -bool HID_Setup(Setup & setup); -void HID_SendReport(uint8_t id, - const void *data, - int len); - -//================================================================================ -//================================================================================ -// MSC 'Driver' - -int MSC_GetInterface(uint8_t * interfaceNum); -int MSC_GetDescriptor(int i); -bool MSC_Setup(Setup & setup); -bool MSC_Data(uint8_t rx, - uint8_t tx); - -//================================================================================ -//================================================================================ -// CSC 'Driver' - -int CDC_GetInterface(uint8_t * interfaceNum); -int CDC_GetDescriptor(int i); -bool CDC_Setup(Setup & setup); - -//================================================================================ -//================================================================================ - -#define TRANSFER_PGM 0x80 -#define TRANSFER_RELEASE 0x40 -#define TRANSFER_ZERO 0x20 - -int USB_SendControl(uint8_t flags, - const void *d, - int len); -int USB_RecvControl(void *d, - int len); - -uint8_t USB_Available(uint8_t ep); -int USB_Send(uint8_t ep, - const void *data, - int len); // blocking -int USB_Recv(uint8_t ep, - void *data, - int len); // non-blocking -int USB_Recv(uint8_t ep); // non-blocking -void USB_Flush(uint8_t ep); - -#endif - -#endif /* if defined(USBCON) */ diff --git a/ports/arduino_uno/external/Arduino/core/include/USBCore.h b/ports/arduino_uno/external/Arduino/core/include/USBCore.h deleted file mode 100644 index b07efa96..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/USBCore.h +++ /dev/null @@ -1,281 +0,0 @@ - -// Copyright (c) 2010, Peter Barrett -/* -** SPDX-License-Identifier: ISC -*/ - -#ifndef __USBCORE_H__ -#define __USBCORE_H__ - -// Standard requests -#define GET_STATUS 0 -#define CLEAR_FEATURE 1 -#define SET_FEATURE 3 -#define SET_ADDRESS 5 -#define GET_DESCRIPTOR 6 -#define SET_DESCRIPTOR 7 -#define GET_CONFIGURATION 8 -#define SET_CONFIGURATION 9 -#define GET_INTERFACE 10 -#define SET_INTERFACE 11 - - -// bmRequestType -#define REQUEST_HOSTTODEVICE 0x00 -#define REQUEST_DEVICETOHOST 0x80 -#define REQUEST_DIRECTION 0x80 - -#define REQUEST_STANDARD 0x00 -#define REQUEST_CLASS 0x20 -#define REQUEST_VENDOR 0x40 -#define REQUEST_TYPE 0x60 - -#define REQUEST_DEVICE 0x00 -#define REQUEST_INTERFACE 0x01 -#define REQUEST_ENDPOINT 0x02 -#define REQUEST_OTHER 0x03 -#define REQUEST_RECIPIENT 0x03 - -#define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE) -#define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE) - -// Class requests - -#define CDC_SET_LINE_CODING 0x20 -#define CDC_GET_LINE_CODING 0x21 -#define CDC_SET_CONTROL_LINE_STATE 0x22 - -#define MSC_RESET 0xFF -#define MSC_GET_MAX_LUN 0xFE - -#define HID_GET_REPORT 0x01 -#define HID_GET_IDLE 0x02 -#define HID_GET_PROTOCOL 0x03 -#define HID_SET_REPORT 0x09 -#define HID_SET_IDLE 0x0A -#define HID_SET_PROTOCOL 0x0B - -// Descriptors - -#define USB_DEVICE_DESC_SIZE 18 -#define USB_CONFIGUARTION_DESC_SIZE 9 -#define USB_INTERFACE_DESC_SIZE 9 -#define USB_ENDPOINT_DESC_SIZE 7 - -#define USB_DEVICE_DESCRIPTOR_TYPE 1 -#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 -#define USB_STRING_DESCRIPTOR_TYPE 3 -#define USB_INTERFACE_DESCRIPTOR_TYPE 4 -#define USB_ENDPOINT_DESCRIPTOR_TYPE 5 - -#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 -#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 -#define USB_DEVICE_CLASS_STORAGE 0x08 -#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF - -#define USB_CONFIG_POWERED_MASK 0x40 -#define USB_CONFIG_BUS_POWERED 0x80 -#define USB_CONFIG_SELF_POWERED 0xC0 -#define USB_CONFIG_REMOTE_WAKEUP 0x20 - -// bMaxPower in Configuration Descriptor -#define USB_CONFIG_POWER_MA(mA) ((mA)/2) - -// bEndpointAddress in Endpoint Descriptor -#define USB_ENDPOINT_DIRECTION_MASK 0x80 -#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) -#define USB_ENDPOINT_IN(addr) ((addr) | 0x80) - -#define USB_ENDPOINT_TYPE_MASK 0x03 -#define USB_ENDPOINT_TYPE_CONTROL 0x00 -#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 -#define USB_ENDPOINT_TYPE_BULK 0x02 -#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 - -#define TOBYTES(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) - -#define CDC_V1_10 0x0110 -#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 - -#define CDC_CALL_MANAGEMENT 0x01 -#define CDC_ABSTRACT_CONTROL_MODEL 0x02 -#define CDC_HEADER 0x00 -#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 -#define CDC_UNION 0x06 -#define CDC_CS_INTERFACE 0x24 -#define CDC_CS_ENDPOINT 0x25 -#define CDC_DATA_INTERFACE_CLASS 0x0A - -#define MSC_SUBCLASS_SCSI 0x06 -#define MSC_PROTOCOL_BULK_ONLY 0x50 - -#define HID_HID_DESCRIPTOR_TYPE 0x21 -#define HID_REPORT_DESCRIPTOR_TYPE 0x22 -#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 - - -// Device -typedef struct { - u8 len; // 18 - u8 dtype; // 1 USB_DEVICE_DESCRIPTOR_TYPE - u16 usbVersion; // 0x200 - u8 deviceClass; - u8 deviceSubClass; - u8 deviceProtocol; - u8 packetSize0; // Packet 0 - u16 idVendor; - u16 idProduct; - u16 deviceVersion; // 0x100 - u8 iManufacturer; - u8 iProduct; - u8 iSerialNumber; - u8 bNumConfigurations; -} DeviceDescriptor; - -// Config -typedef struct { - u8 len; // 9 - u8 dtype; // 2 - u16 clen; // total length - u8 numInterfaces; - u8 config; - u8 iconfig; - u8 attributes; - u8 maxPower; -} ConfigDescriptor; - -// String - -// Interface -typedef struct { - u8 len; // 9 - u8 dtype; // 4 - u8 number; - u8 alternate; - u8 numEndpoints; - u8 interfaceClass; - u8 interfaceSubClass; - u8 protocol; - u8 iInterface; -} InterfaceDescriptor; - -// Endpoint -typedef struct { - u8 len; // 7 - u8 dtype; // 5 - u8 addr; - u8 attr; - u16 packetSize; - u8 interval; -} EndpointDescriptor; - -// Interface Association Descriptor -// Used to bind 2 interfaces together in CDC compostite device -typedef struct { - u8 len; // 8 - u8 dtype; // 11 - u8 firstInterface; - u8 interfaceCount; - u8 functionClass; - u8 funtionSubClass; - u8 functionProtocol; - u8 iInterface; -} IADDescriptor; - -// CDC CS interface descriptor -typedef struct { - u8 len; // 5 - u8 dtype; // 0x24 - u8 subtype; - u8 d0; - u8 d1; -} CDCCSInterfaceDescriptor; - -typedef struct { - u8 len; // 4 - u8 dtype; // 0x24 - u8 subtype; - u8 d0; -} CDCCSInterfaceDescriptor4; - -typedef struct { - u8 len; - u8 dtype; // 0x24 - u8 subtype; // 1 - u8 bmCapabilities; - u8 bDataInterface; -} CMFunctionalDescriptor; - -typedef struct { - u8 len; - u8 dtype; // 0x24 - u8 subtype; // 1 - u8 bmCapabilities; -} ACMFunctionalDescriptor; - -typedef struct { - // IAD - IADDescriptor iad; // Only needed on compound device - - // Control - InterfaceDescriptor cif; // - CDCCSInterfaceDescriptor header; - CMFunctionalDescriptor callManagement; // Call Management - ACMFunctionalDescriptor controlManagement; // ACM - CDCCSInterfaceDescriptor functionalDescriptor; // CDC_UNION - EndpointDescriptor cifin; - - // Data - InterfaceDescriptor dif; - EndpointDescriptor in; - EndpointDescriptor out; -} CDCDescriptor; - -typedef struct { - InterfaceDescriptor msc; - EndpointDescriptor in; - EndpointDescriptor out; -} MSCDescriptor; - -typedef struct { - u8 len; // 9 - u8 dtype; // 0x21 - u8 addr; - u8 versionL; // 0x101 - u8 versionH; // 0x101 - u8 country; - u8 desctype; // 0x22 report - u8 descLenL; - u8 descLenH; -} HIDDescDescriptor; - -typedef struct { - InterfaceDescriptor hid; - HIDDescDescriptor desc; - EndpointDescriptor in; -} HIDDescriptor; - - -#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ - { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } - -#define D_CONFIG(_totalLength,_interfaces) \ - { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) } - -#define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \ - { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 } - -#define D_ENDPOINT(_addr,_attr,_packetSize, _interval) \ - { 7, 5, _addr,_attr,_packetSize, _interval } - -#define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \ - { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 } - -#define D_HIDREPORT(_descriptorLength) \ - { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 } - -#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 } -#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 } - - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/Udp.h b/ports/arduino_uno/external/Arduino/core/include/Udp.h deleted file mode 100644 index 14b6f767..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/Udp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Udp.cpp: Library to send/receive UDP packets. - * - * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) - * 1) UDP does not guarantee the order in which assembled UDP packets are received. This - * might not happen often in practice, but in larger network topologies, a UDP - * packet can be received out of sequence. - * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being - * aware of it. Again, this may not be a concern in practice on small local networks. - * For more information, see http://www.cafeaulait.org/course/week12/35.html - * - * Copyright (c) 2008 Bjoern Hartmann - * - * SPDX-License-Identifier: MIT - * - * bjoern@cs.stanford.edu 12/30/2008 - */ - -#ifndef udp_h -#define udp_h - -#include -#include - -class UDP:public Stream { - - public: - virtual uint8_t begin(uint16_t) = 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual void stop() = 0; // Finish with the UDP socket - - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, - uint16_t port) = 0; - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char *host, - uint16_t port) = 0; - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket() = 0; - // Write a single byte into the packet - virtual size_t write(uint8_t) = 0; - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t * buffer, - size_t size) = 0; - - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket() = 0; - // Number of bytes remaining in the current packet - virtual int available() = 0; - // Read a single byte from the current packet - virtual int read() = 0; - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char *buffer, - size_t len) = 0; - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char *buffer, - size_t len) = 0; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek() = 0; - virtual void flush() = 0; // Finish reading the current packet - - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP() = 0; - // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort() = 0; - protected: - uint8_t * rawIPAddress(IPAddress & addr) { - return addr.raw_address(); - }; -}; - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/binary.h b/ports/arduino_uno/external/Arduino/core/include/binary.h deleted file mode 100644 index af149803..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/binary.h +++ /dev/null @@ -1,515 +0,0 @@ -#ifndef Binary_h -#define Binary_h - -#define B0 0 -#define B00 0 -#define B000 0 -#define B0000 0 -#define B00000 0 -#define B000000 0 -#define B0000000 0 -#define B00000000 0 -#define B1 1 -#define B01 1 -#define B001 1 -#define B0001 1 -#define B00001 1 -#define B000001 1 -#define B0000001 1 -#define B00000001 1 -#define B10 2 -#define B010 2 -#define B0010 2 -#define B00010 2 -#define B000010 2 -#define B0000010 2 -#define B00000010 2 -#define B11 3 -#define B011 3 -#define B0011 3 -#define B00011 3 -#define B000011 3 -#define B0000011 3 -#define B00000011 3 -#define B100 4 -#define B0100 4 -#define B00100 4 -#define B000100 4 -#define B0000100 4 -#define B00000100 4 -#define B101 5 -#define B0101 5 -#define B00101 5 -#define B000101 5 -#define B0000101 5 -#define B00000101 5 -#define B110 6 -#define B0110 6 -#define B00110 6 -#define B000110 6 -#define B0000110 6 -#define B00000110 6 -#define B111 7 -#define B0111 7 -#define B00111 7 -#define B000111 7 -#define B0000111 7 -#define B00000111 7 -#define B1000 8 -#define B01000 8 -#define B001000 8 -#define B0001000 8 -#define B00001000 8 -#define B1001 9 -#define B01001 9 -#define B001001 9 -#define B0001001 9 -#define B00001001 9 -#define B1010 10 -#define B01010 10 -#define B001010 10 -#define B0001010 10 -#define B00001010 10 -#define B1011 11 -#define B01011 11 -#define B001011 11 -#define B0001011 11 -#define B00001011 11 -#define B1100 12 -#define B01100 12 -#define B001100 12 -#define B0001100 12 -#define B00001100 12 -#define B1101 13 -#define B01101 13 -#define B001101 13 -#define B0001101 13 -#define B00001101 13 -#define B1110 14 -#define B01110 14 -#define B001110 14 -#define B0001110 14 -#define B00001110 14 -#define B1111 15 -#define B01111 15 -#define B001111 15 -#define B0001111 15 -#define B00001111 15 -#define B10000 16 -#define B010000 16 -#define B0010000 16 -#define B00010000 16 -#define B10001 17 -#define B010001 17 -#define B0010001 17 -#define B00010001 17 -#define B10010 18 -#define B010010 18 -#define B0010010 18 -#define B00010010 18 -#define B10011 19 -#define B010011 19 -#define B0010011 19 -#define B00010011 19 -#define B10100 20 -#define B010100 20 -#define B0010100 20 -#define B00010100 20 -#define B10101 21 -#define B010101 21 -#define B0010101 21 -#define B00010101 21 -#define B10110 22 -#define B010110 22 -#define B0010110 22 -#define B00010110 22 -#define B10111 23 -#define B010111 23 -#define B0010111 23 -#define B00010111 23 -#define B11000 24 -#define B011000 24 -#define B0011000 24 -#define B00011000 24 -#define B11001 25 -#define B011001 25 -#define B0011001 25 -#define B00011001 25 -#define B11010 26 -#define B011010 26 -#define B0011010 26 -#define B00011010 26 -#define B11011 27 -#define B011011 27 -#define B0011011 27 -#define B00011011 27 -#define B11100 28 -#define B011100 28 -#define B0011100 28 -#define B00011100 28 -#define B11101 29 -#define B011101 29 -#define B0011101 29 -#define B00011101 29 -#define B11110 30 -#define B011110 30 -#define B0011110 30 -#define B00011110 30 -#define B11111 31 -#define B011111 31 -#define B0011111 31 -#define B00011111 31 -#define B100000 32 -#define B0100000 32 -#define B00100000 32 -#define B100001 33 -#define B0100001 33 -#define B00100001 33 -#define B100010 34 -#define B0100010 34 -#define B00100010 34 -#define B100011 35 -#define B0100011 35 -#define B00100011 35 -#define B100100 36 -#define B0100100 36 -#define B00100100 36 -#define B100101 37 -#define B0100101 37 -#define B00100101 37 -#define B100110 38 -#define B0100110 38 -#define B00100110 38 -#define B100111 39 -#define B0100111 39 -#define B00100111 39 -#define B101000 40 -#define B0101000 40 -#define B00101000 40 -#define B101001 41 -#define B0101001 41 -#define B00101001 41 -#define B101010 42 -#define B0101010 42 -#define B00101010 42 -#define B101011 43 -#define B0101011 43 -#define B00101011 43 -#define B101100 44 -#define B0101100 44 -#define B00101100 44 -#define B101101 45 -#define B0101101 45 -#define B00101101 45 -#define B101110 46 -#define B0101110 46 -#define B00101110 46 -#define B101111 47 -#define B0101111 47 -#define B00101111 47 -#define B110000 48 -#define B0110000 48 -#define B00110000 48 -#define B110001 49 -#define B0110001 49 -#define B00110001 49 -#define B110010 50 -#define B0110010 50 -#define B00110010 50 -#define B110011 51 -#define B0110011 51 -#define B00110011 51 -#define B110100 52 -#define B0110100 52 -#define B00110100 52 -#define B110101 53 -#define B0110101 53 -#define B00110101 53 -#define B110110 54 -#define B0110110 54 -#define B00110110 54 -#define B110111 55 -#define B0110111 55 -#define B00110111 55 -#define B111000 56 -#define B0111000 56 -#define B00111000 56 -#define B111001 57 -#define B0111001 57 -#define B00111001 57 -#define B111010 58 -#define B0111010 58 -#define B00111010 58 -#define B111011 59 -#define B0111011 59 -#define B00111011 59 -#define B111100 60 -#define B0111100 60 -#define B00111100 60 -#define B111101 61 -#define B0111101 61 -#define B00111101 61 -#define B111110 62 -#define B0111110 62 -#define B00111110 62 -#define B111111 63 -#define B0111111 63 -#define B00111111 63 -#define B1000000 64 -#define B01000000 64 -#define B1000001 65 -#define B01000001 65 -#define B1000010 66 -#define B01000010 66 -#define B1000011 67 -#define B01000011 67 -#define B1000100 68 -#define B01000100 68 -#define B1000101 69 -#define B01000101 69 -#define B1000110 70 -#define B01000110 70 -#define B1000111 71 -#define B01000111 71 -#define B1001000 72 -#define B01001000 72 -#define B1001001 73 -#define B01001001 73 -#define B1001010 74 -#define B01001010 74 -#define B1001011 75 -#define B01001011 75 -#define B1001100 76 -#define B01001100 76 -#define B1001101 77 -#define B01001101 77 -#define B1001110 78 -#define B01001110 78 -#define B1001111 79 -#define B01001111 79 -#define B1010000 80 -#define B01010000 80 -#define B1010001 81 -#define B01010001 81 -#define B1010010 82 -#define B01010010 82 -#define B1010011 83 -#define B01010011 83 -#define B1010100 84 -#define B01010100 84 -#define B1010101 85 -#define B01010101 85 -#define B1010110 86 -#define B01010110 86 -#define B1010111 87 -#define B01010111 87 -#define B1011000 88 -#define B01011000 88 -#define B1011001 89 -#define B01011001 89 -#define B1011010 90 -#define B01011010 90 -#define B1011011 91 -#define B01011011 91 -#define B1011100 92 -#define B01011100 92 -#define B1011101 93 -#define B01011101 93 -#define B1011110 94 -#define B01011110 94 -#define B1011111 95 -#define B01011111 95 -#define B1100000 96 -#define B01100000 96 -#define B1100001 97 -#define B01100001 97 -#define B1100010 98 -#define B01100010 98 -#define B1100011 99 -#define B01100011 99 -#define B1100100 100 -#define B01100100 100 -#define B1100101 101 -#define B01100101 101 -#define B1100110 102 -#define B01100110 102 -#define B1100111 103 -#define B01100111 103 -#define B1101000 104 -#define B01101000 104 -#define B1101001 105 -#define B01101001 105 -#define B1101010 106 -#define B01101010 106 -#define B1101011 107 -#define B01101011 107 -#define B1101100 108 -#define B01101100 108 -#define B1101101 109 -#define B01101101 109 -#define B1101110 110 -#define B01101110 110 -#define B1101111 111 -#define B01101111 111 -#define B1110000 112 -#define B01110000 112 -#define B1110001 113 -#define B01110001 113 -#define B1110010 114 -#define B01110010 114 -#define B1110011 115 -#define B01110011 115 -#define B1110100 116 -#define B01110100 116 -#define B1110101 117 -#define B01110101 117 -#define B1110110 118 -#define B01110110 118 -#define B1110111 119 -#define B01110111 119 -#define B1111000 120 -#define B01111000 120 -#define B1111001 121 -#define B01111001 121 -#define B1111010 122 -#define B01111010 122 -#define B1111011 123 -#define B01111011 123 -#define B1111100 124 -#define B01111100 124 -#define B1111101 125 -#define B01111101 125 -#define B1111110 126 -#define B01111110 126 -#define B1111111 127 -#define B01111111 127 -#define B10000000 128 -#define B10000001 129 -#define B10000010 130 -#define B10000011 131 -#define B10000100 132 -#define B10000101 133 -#define B10000110 134 -#define B10000111 135 -#define B10001000 136 -#define B10001001 137 -#define B10001010 138 -#define B10001011 139 -#define B10001100 140 -#define B10001101 141 -#define B10001110 142 -#define B10001111 143 -#define B10010000 144 -#define B10010001 145 -#define B10010010 146 -#define B10010011 147 -#define B10010100 148 -#define B10010101 149 -#define B10010110 150 -#define B10010111 151 -#define B10011000 152 -#define B10011001 153 -#define B10011010 154 -#define B10011011 155 -#define B10011100 156 -#define B10011101 157 -#define B10011110 158 -#define B10011111 159 -#define B10100000 160 -#define B10100001 161 -#define B10100010 162 -#define B10100011 163 -#define B10100100 164 -#define B10100101 165 -#define B10100110 166 -#define B10100111 167 -#define B10101000 168 -#define B10101001 169 -#define B10101010 170 -#define B10101011 171 -#define B10101100 172 -#define B10101101 173 -#define B10101110 174 -#define B10101111 175 -#define B10110000 176 -#define B10110001 177 -#define B10110010 178 -#define B10110011 179 -#define B10110100 180 -#define B10110101 181 -#define B10110110 182 -#define B10110111 183 -#define B10111000 184 -#define B10111001 185 -#define B10111010 186 -#define B10111011 187 -#define B10111100 188 -#define B10111101 189 -#define B10111110 190 -#define B10111111 191 -#define B11000000 192 -#define B11000001 193 -#define B11000010 194 -#define B11000011 195 -#define B11000100 196 -#define B11000101 197 -#define B11000110 198 -#define B11000111 199 -#define B11001000 200 -#define B11001001 201 -#define B11001010 202 -#define B11001011 203 -#define B11001100 204 -#define B11001101 205 -#define B11001110 206 -#define B11001111 207 -#define B11010000 208 -#define B11010001 209 -#define B11010010 210 -#define B11010011 211 -#define B11010100 212 -#define B11010101 213 -#define B11010110 214 -#define B11010111 215 -#define B11011000 216 -#define B11011001 217 -#define B11011010 218 -#define B11011011 219 -#define B11011100 220 -#define B11011101 221 -#define B11011110 222 -#define B11011111 223 -#define B11100000 224 -#define B11100001 225 -#define B11100010 226 -#define B11100011 227 -#define B11100100 228 -#define B11100101 229 -#define B11100110 230 -#define B11100111 231 -#define B11101000 232 -#define B11101001 233 -#define B11101010 234 -#define B11101011 235 -#define B11101100 236 -#define B11101101 237 -#define B11101110 238 -#define B11101111 239 -#define B11110000 240 -#define B11110001 241 -#define B11110010 242 -#define B11110011 243 -#define B11110100 244 -#define B11110101 245 -#define B11110110 246 -#define B11110111 247 -#define B11111000 248 -#define B11111001 249 -#define B11111010 250 -#define B11111011 251 -#define B11111100 252 -#define B11111101 253 -#define B11111110 254 -#define B11111111 255 - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/new.h b/ports/arduino_uno/external/Arduino/core/include/new.h deleted file mode 100644 index a140914e..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/new.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Header to define new/delete operators as they aren't provided by avr-gcc by default - Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 - */ - -#ifndef NEW_H -#define NEW_H - -#include - -void *operator new(size_t size); -void operator delete(void *ptr); - -__extension__ typedef int __guard __attribute__ ((mode(__DI__))); - -extern "C" int __cxa_guard_acquire(__guard *); -extern "C" void __cxa_guard_release(__guard *); -extern "C" void __cxa_guard_abort(__guard *); - -extern "C" void __cxa_pure_virtual(void); - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/pins_arduino.h b/ports/arduino_uno/external/Arduino/core/include/pins_arduino.h deleted file mode 100644 index acb65cf1..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/pins_arduino.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - SPDX-License-Identifier: LGPL-2.1-or-later - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -#define NUM_DIGITAL_PINS 20 -#define NUM_ANALOG_INPUTS 6 -#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1) - -#if defined(__AVR_ATmega8__) -#define digitalPinHasPWM(p) ((p) == 9 || (p) == 10 || (p) == 11) -#else -#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11) -#endif - -static const uint8_t SS = 10; -static const uint8_t MOSI = 11; -static const uint8_t MISO = 12; -static const uint8_t SCK = 13; - -static const uint8_t SDA = 18; -static const uint8_t SCL = 19; -static const uint8_t LED_BUILTIN = 13; - -static const uint8_t A0 = 14; -static const uint8_t A1 = 15; -static const uint8_t A2 = 16; -static const uint8_t A3 = 17; -static const uint8_t A4 = 18; -static const uint8_t A5 = 19; -static const uint8_t A6 = 20; -static const uint8_t A7 = 21; - -#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1)) -#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0)))) -#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA8 & 168 / ARDUINO -// -// +-\/-+ -// PC6 1| |28 PC5 (AI 5) -// (D 0) PD0 2| |27 PC4 (AI 4) -// (D 1) PD1 3| |26 PC3 (AI 3) -// (D 2) PD2 4| |25 PC2 (AI 2) -// PWM+ (D 3) PD3 5| |24 PC1 (AI 1) -// (D 4) PD4 6| |23 PC0 (AI 0) -// VCC 7| |22 GND -// GND 8| |21 AREF -// PB6 9| |20 AVCC -// PB7 10| |19 PB5 (D 13) -// PWM+ (D 5) PD5 11| |18 PB4 (D 12) -// PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM -// (D 7) PD7 13| |16 PB2 (D 10) PWM -// (D 8) PB0 14| |15 PB1 (D 9) PWM -// +----+ -// -// (PWM+ indicates the additional PWM pins on the ATmega168.) - -// ATMEL ATMEGA1280 / ARDUINO -// -// 0-7 PE0-PE7 works -// 8-13 PB0-PB5 works -// 14-21 PA0-PA7 works -// 22-29 PH0-PH7 works -// 30-35 PG5-PG0 works -// 36-43 PC7-PC0 works -// 44-51 PJ7-PJ0 works -// 52-59 PL7-PL0 works -// 60-67 PD7-PD0 works -// A0-A7 PF0-PF7 -// A8-A15 PK0-PK7 - - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) & DDRB, - (uint16_t) & DDRC, - (uint16_t) & DDRD, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) & PORTB, - (uint16_t) & PORTC, - (uint16_t) & PORTD, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) & PINB, - (uint16_t) & PINC, - (uint16_t) & PIND, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, /* 0 */ - PD, - PD, - PD, - PD, - PD, - PD, - PD, - PB, /* 8 */ - PB, - PB, - PB, - PB, - PB, - PC, /* 14 */ - PC, - PC, - PC, - PC, - PC, -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(0), /* 0, port D */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), - _BV(6), - _BV(7), - _BV(0), /* 8, port B */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), - _BV(0), /* 14, port C */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, /* 0 - port D */ - NOT_ON_TIMER, - NOT_ON_TIMER, - // on the ATmega168, digital pin 3 has hardware pwm -#if defined(__AVR_ATmega8__) - NOT_ON_TIMER, -#else - TIMER2B, -#endif - NOT_ON_TIMER, - // on the ATmega168, digital pins 5 and 6 have hardware pwm -#if defined(__AVR_ATmega8__) - NOT_ON_TIMER, - NOT_ON_TIMER, -#else - TIMER0B, - TIMER0A, -#endif - NOT_ON_TIMER, - NOT_ON_TIMER, /* 8 - port B */ - TIMER1A, - TIMER1B, -#if defined(__AVR_ATmega8__) - TIMER2, -#else - TIMER2A, -#endif - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, /* 14 - port C */ - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -#endif - -#endif diff --git a/ports/arduino_uno/external/Arduino/core/include/wiring_private.h b/ports/arduino_uno/external/Arduino/core/include/wiring_private.h deleted file mode 100644 index f9f8def7..00000000 --- a/ports/arduino_uno/external/Arduino/core/include/wiring_private.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - wiring_private.h - Internal header file. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - SPDX-License-Identifier: LGPL-2.1-or-later - - $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ -*/ - -#ifndef WiringPrivate_h -#define WiringPrivate_h - -#include -#include -#include -#include - -#include "Arduino.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef cbi -#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) -#endif -#ifndef sbi -#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) -#endif - -#define EXTERNAL_INT_0 0 -#define EXTERNAL_INT_1 1 -#define EXTERNAL_INT_2 2 -#define EXTERNAL_INT_3 3 -#define EXTERNAL_INT_4 4 -#define EXTERNAL_INT_5 5 -#define EXTERNAL_INT_6 6 -#define EXTERNAL_INT_7 7 - -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define EXTERNAL_NUM_INTERRUPTS 8 -#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) -#define EXTERNAL_NUM_INTERRUPTS 3 -#elif defined(__AVR_ATmega32U4__) -#define EXTERNAL_NUM_INTERRUPTS 4 -#else -#define EXTERNAL_NUM_INTERRUPTS 2 -#endif - - typedef void (*voidFuncPtr) (void); - -#ifdef __cplusplus -} // extern "C" -#endif -#endif diff --git a/ports/arduino_uno/h_rp.c b/ports/arduino_uno/h_rp.c deleted file mode 100644 index 1062fea4..00000000 --- a/ports/arduino_uno/h_rp.c +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -#include -#include -#include -#include "bacnet/config.h" -#include "bacnet/basic/tsm/tsm.h" -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacerror.h" -#include "bacnet/apdu.h" -#include "bacnet/npdu.h" -#include "abort.h" -#include "bacnet/rp.h" -/* demo objects */ -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/av.h" -#include "bacnet/basic/object/bv.h" - -/* Encodes the property APDU and returns the length, - or sets the error, and returns -1 */ -int Encode_Property_APDU( - uint8_t *apdu, - BACNET_READ_PROPERTY_DATA *rp_data, - BACNET_ERROR_CLASS *error_class, - BACNET_ERROR_CODE *error_code) -{ - int apdu_len = -1; - - /* handle each object type */ - switch (rp_data->object_type) { - case OBJECT_DEVICE: - if (Device_Valid_Object_Instance_Number(rp_data->object_instance)) { - apdu_len = Device_Encode_Property_APDU( - &apdu[0], rp_data->object_instance, - rp_data->object_property, rp_data->array_index, error_class, - error_code); - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Valid_Instance(rp_data->object_instance)) { - apdu_len = Analog_Value_Encode_Property_APDU( - &apdu[0], rp_data->object_instance, - rp_data->object_property, rp_data->array_index, error_class, - error_code); - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Valid_Instance(rp_data->object_instance)) { - apdu_len = Binary_Value_Encode_Property_APDU( - &apdu[0], rp_data->object_instance, - rp_data->object_property, rp_data->array_index, error_class, - error_code); - } - break; - default: - *error_class = ERROR_CLASS_OBJECT; - *error_code = ERROR_CODE_UNKNOWN_OBJECT; - break; - } - - return apdu_len; -} - -void handler_read_property( - uint8_t *service_request, - uint16_t service_len, - BACNET_ADDRESS *src, - BACNET_CONFIRMED_SERVICE_DATA *service_data) -{ - BACNET_READ_PROPERTY_DATA data; - int len = 0; - int ack_len = 0; - int property_len = 0; - int pdu_len = 0; - BACNET_NPDU_DATA npdu_data; - BACNET_ERROR_CLASS error_class = ERROR_CLASS_OBJECT; - BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT; - BACNET_ADDRESS my_address; - - /* encode the NPDU portion of the packet */ - datalink_get_my_address(&my_address); - npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); - pdu_len = npdu_encode_pdu( - &Handler_Transmit_Buffer[0], src, &my_address, &npdu_data); - if (service_data->segmented_message) { - /* we don't support segmentation - send an abort */ - len = abort_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true); - goto RP_ABORT; - } - len = rp_decode_service_request(service_request, service_len, &data); - if (len < 0) { - /* bad decoding - send an abort */ - len = abort_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - ABORT_REASON_OTHER, true); - goto RP_ABORT; - } - /* most cases will be error */ - ack_len = rp_ack_encode_apdu_init( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, &data); - /* FIXME: add buffer len as passed into function or use smart buffer */ - property_len = Encode_Property_APDU( - &Handler_Transmit_Buffer[pdu_len + ack_len], &data, &error_class, - &error_code); - if (property_len >= 0) { - len = rp_ack_encode_apdu_object_property_end( - &Handler_Transmit_Buffer[pdu_len + property_len + ack_len]); - len += ack_len + property_len; - } else { - switch (property_len) { - /* BACnet APDU too small to fit data, so proper response is - * Abort */ - case BACNET_STATUS_ABORT: - len = abort_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true); - break; - default: - len = bacerror_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - SERVICE_CONFIRMED_READ_PROPERTY, error_class, error_code); - break; - } - } -RP_ABORT: - pdu_len += len; - - datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len); - - return; -} diff --git a/ports/arduino_uno/h_whois.c b/ports/arduino_uno/h_whois.c deleted file mode 100644 index 457fdc44..00000000 --- a/ports/arduino_uno/h_whois.c +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -#include -#include -#include -#include "bacnet/config.h" -#include "bacnet/basic/tsm/tsm.h" -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/whois.h" -#include "bacnet/iam.h" -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/tsm/tsm.h" - -bool Send_I_Am_Flag = true; - -void sendIamUnicast(uint8_t *buffer, BACNET_ADDRESS *src) -{ - BACNET_ADDRESS dest; - int pdu_len = 0; - BACNET_NPDU_DATA npdu_data; - - /* encode the data */ - int npdu_len = 0; - int apdu_len = 0; - BACNET_ADDRESS my_address; - /* The destination will be the same as the src, so copy it over. */ - memcpy(&dest, src, sizeof(BACNET_ADDRESS)); - /* dest->net = 0; - no, must direct back to src->net to meet BTL tests */ - - datalink_get_my_address(&my_address); - /* encode the NPDU portion of the packet */ - npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); - npdu_len = npdu_encode_pdu(&buffer[0], &dest, &my_address, &npdu_data); - /* encode the APDU portion of the packet */ - apdu_len = iam_encode_apdu( - &buffer[npdu_len], Device_Object_Instance_Number(), MAX_APDU, - SEGMENTATION_NONE, Device_Vendor_Identifier()); - /* send data */ - pdu_len = npdu_len + apdu_len; - int bytes = datalink_send_pdu(&dest, &npdu_data, &buffer[0], pdu_len); -} - -void handler_who_is( - uint8_t *service_request, uint16_t service_len, BACNET_ADDRESS *src) -{ - int len = 0; - int32_t low_limit = 0; - int32_t high_limit = 0; - int32_t target_device; - - len = whois_decode_service_request( - service_request, service_len, &low_limit, &high_limit); - if (len == 0) { - sendIamUnicast(&Handler_Transmit_Buffer[0], src); - } else if (len != -1) { - /* is my device id within the limits? */ - target_device = Device_Object_Instance_Number(); - if ((target_device >= low_limit) && (target_device <= high_limit)) { - sendIamUnicast(&Handler_Transmit_Buffer[0], src); - } - } - - return; -} diff --git a/ports/arduino_uno/h_wp.c b/ports/arduino_uno/h_wp.c deleted file mode 100644 index 95c992eb..00000000 --- a/ports/arduino_uno/h_wp.c +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -#include -#include -#include -#include "bacnet/config.h" -#include "bacnet/basic/tsm/tsm.h" -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacerror.h" -#include "bacnet/apdu.h" -#include "bacnet/npdu.h" -#include "abort.h" -#include "bacnet/wp.h" -/* demo objects */ -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/av.h" -#include "bacnet/basic/object/bv.h" - -/* too big to reside on stack frame for PIC */ -static BACNET_WRITE_PROPERTY_DATA wp_data; - -void handler_write_property( - uint8_t *service_request, - uint16_t service_len, - BACNET_ADDRESS *src, - BACNET_CONFIRMED_SERVICE_DATA *service_data) -{ - int len = 0; - int pdu_len = 0; - BACNET_NPDU_DATA npdu_data; - BACNET_ERROR_CLASS error_class = ERROR_CLASS_OBJECT; - BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT; - BACNET_ADDRESS my_address; - - /* decode the service request only */ - len = wp_decode_service_request(service_request, service_len, &wp_data); - /* encode the NPDU portion of the packet */ - datalink_get_my_address(&my_address); - npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); - pdu_len = npdu_encode_pdu( - &Handler_Transmit_Buffer[0], src, &my_address, &npdu_data); - /* bad decoding or something we didn't understand - send an abort */ - if (len <= 0) { - len = abort_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - ABORT_REASON_OTHER, true); - } else if (service_data->segmented_message) { - len = abort_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true); - } else { - switch (wp_data.object_type) { - case OBJECT_DEVICE: - if (Device_Write_Property( - &wp_data, &error_class, &error_code)) { - len = encode_simple_ack( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY); - } else { - len = bacerror_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY, error_class, - error_code); - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Write_Property( - &wp_data, &error_class, &error_code)) { - len = encode_simple_ack( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY); - } else { - len = bacerror_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY, error_class, - error_code); - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Write_Property( - &wp_data, &error_class, &error_code)) { - len = encode_simple_ack( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY); - } else { - len = bacerror_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], - service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY, error_class, - error_code); - } - break; - default: - len = bacerror_encode_apdu( - &Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, - SERVICE_CONFIRMED_WRITE_PROPERTY, error_class, error_code); - break; - } - } - pdu_len += len; - datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len); - - return; -} diff --git a/ports/arduino_uno/main.c b/ports/arduino_uno/main.c deleted file mode 100644 index 6dd1b6e7..00000000 --- a/ports/arduino_uno/main.c +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file - * @author Miguel Fernandes - * @date 6 de Jun de 2013 - * @brief BACnet/IP for Wiznet on Arduino-Uno - * - * This port is for BACnet/ip and uses part of the Arduino Ethernet - * library so it needs the stock Arduino Etherenet Shield - * (the one with the W5100 chip). The port was done by writting a C - * wrapper around the c++ Ethernet library and adapting the - * existing port for Atmega168 (mainly functions bip.c and bip-init.c) - * to use the wrapper functions. The port also needs Arduino core and - * Ethernet libraries to compile. - */ -#include -#include -#include "bacnet/datalink/datalink.h" -#include "bacnet/npdu.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/tsm/tsm.h" -#include "bacnet/iam.h" -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/av.h" -#include "uart.h" -#include "w5100Wrapper.h" -#include "Arduino.h" -#include -#define BAUD 9600 -#include - -/* From the WhoIs hander - performed by the DLMSTP module */ -extern bool Send_I_Am_Flag; -/* local version override */ -const char *BACnet_Version = "1.0"; -static uint8_t Ethernet_MAC_Address[MAX_MAC_LEN] = { 0xDE, 0xAD, 0xBE, - 0xEF, 0xFE, 0xED }; -uint8_t ipAddress[] = { 192, 168, 0, 185 }; -uint8_t gateway[] = { 192, 168, 0, 1 }; -uint8_t netmask[] = { 255, 255, 255, 0 }; - -FILE uart_output = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); -FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ); -FILE uart_io = FDEV_SETUP_STREAM(uart_putchar, uart_getchar, _FDEV_SETUP_RW); - -/* For porting to IAR, see: - http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC/IarToAvrgcc*/ - -/* dummy function - so we can use default demo handlers */ -bool dcc_communication_enabled(void) -{ - return true; -} - -void setup() -{ - // INIT W5100 - init_func(CW5100Class_new()); - setMACAddress_func(CW5100Class_new(), Ethernet_MAC_Address); - setIPAddress_func(CW5100Class_new(), ipAddress); - setGatewayIp_func(CW5100Class_new(), gateway); - setSubnetMask_func(CW5100Class_new(), netmask); - - uart_init(); - stdout = &uart_output; - stdin = &uart_input; - stderr = &uart_output; - -#ifdef DEBUG - fprintf(stderr, "Starting BACNET application..\n"); -#endif -} - -/** Static receive buffer, initialized with zeros by the C Library Startup Code. - */ - -static uint8_t PDUBuffer - [MAX_MPDU + 16 /* Add a little safety margin to the buffer, - * so that in the rare case, the message - * would be filled up to MAX_MPDU and some - * decoding functions would overrun, these - * decoding functions will just end up in - * a safe field of static zeros. */ -]; - -/** Main */ - -int main(void) -{ - uint16_t pdu_len = 0; - BACNET_ADDRESS src; /* source address */ - - init(); - - setup(); - - datalink_init(NULL); - for (;;) { - /* other tasks */ - /* BACnet handling */ - pdu_len = datalink_receive(&src, &PDUBuffer[0], MAX_MPDU, 0); - if (pdu_len) { - npdu_handler(&src, &PDUBuffer[0], pdu_len); - } - } -} diff --git a/ports/arduino_uno/stdbool.h b/ports/arduino_uno/stdbool.h deleted file mode 100644 index 68a1d8da..00000000 --- a/ports/arduino_uno/stdbool.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STDBOOL_H -#define STDBOOL_H - -/* C99 Boolean types for compilers without C99 support */ - -#ifndef __cplusplus -/* typedef char _Bool; */ -#ifndef bool -#define bool _Bool -#endif -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif -#define __bool_true_false_are_defined 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#endif diff --git a/ports/arduino_uno/stdint.h b/ports/arduino_uno/stdint.h deleted file mode 100644 index b9c93401..00000000 --- a/ports/arduino_uno/stdint.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Defines the standard integer types that are used in code */ - -#ifndef STDINT_H -#define STDINT_H 1 - -#include - -typedef unsigned char uint8_t; /* 1 byte 0 to 255 */ -typedef signed char int8_t; /* 1 byte -127 to 127 */ -typedef unsigned short uint16_t; /* 2 bytes 0 to 65535 */ -typedef signed short int16_t; /* 2 bytes -32767 to 32767 */ -typedef unsigned long uint32_t; /* 4 bytes 0 to 4294967295 */ -typedef signed long int32_t; /* 4 bytes -2147483647 to 2147483647 */ - -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647 - 1) - -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 - -#define UINT8_MAX 0xff /* 255U */ -#define UINT16_MAX 0xffff /* 65535U */ -#define UINT32_MAX 0xffffffff /* 4294967295U */ - -#endif /* STDINT_H */ diff --git a/ports/arduino_uno/txbuf.h b/ports/arduino_uno/txbuf.h deleted file mode 100644 index 1360afb7..00000000 --- a/ports/arduino_uno/txbuf.h +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef TXBUF_H -#define TXBUF_H - -#include -#include -#include "bacnet/config.h" -#include "bacnet/datalink/datalink.h" - -extern uint8_t Handler_Transmit_Buffer[MAX_PDU]; - -#endif diff --git a/ports/arduino_uno/uart.c b/ports/arduino_uno/uart.c deleted file mode 100644 index 20db8b8f..00000000 --- a/ports/arduino_uno/uart.c +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file - * @author Miguel Fernandes - * @date 6 de Jun de 2013 - * @brief For redirecting stdout, stdin and stderr - * see http://www.appelsiini.net/2011/simple-usart-with-avr-libc - */ -#include -#include -#include -#include -#include "hardware.h" -#include "uart.h" - -void uart_init(void) -{ - UBRR0H = UBRRH_VALUE; - UBRR0L = UBRRL_VALUE; - -#if USE_2X - UCSR0A |= _BV(U2X0); -#else - UCSR0A &= ~(_BV(U2X0)); -#endif - - UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ - UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ -} - -void uart_putchar(char c, FILE *stream) -{ - if (c == '\n') { - uart_putchar('\r', stream); - } - loop_until_bit_is_set(UCSR0A, UDRE0); - UDR0 = c; -} - -char uart_getchar(FILE *stream) -{ - loop_until_bit_is_set(UCSR0A, RXC0); /* Wait until data exists. */ - return UDR0; -} diff --git a/ports/arduino_uno/uart.h b/ports/arduino_uno/uart.h deleted file mode 100644 index 38c20602..00000000 --- a/ports/arduino_uno/uart.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file - * @author Miguel Fernandes - * @date 6 de Jun de 2013 - * @brief BACnet Virtual Link Control for Wiznet on Arduino-Uno - */ -#ifndef UART_H_ -#define UART_H_ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -void uart_init(void); -void uart_putchar(char c, FILE *stream); -char uart_getchar(FILE *stream); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f6720/.clang-format b/ports/pic18f6720/.clang-format deleted file mode 100644 index 579a192a..00000000 --- a/ports/pic18f6720/.clang-format +++ /dev/null @@ -1,7 +0,0 @@ ---- -# Disable formatting for now as there is external code. We should move external -# code to a separate directory and enable formatting for our code. -DisableFormat: true - -# DisableFormat will not disable include sorting with some versions. -SortIncludes: Never diff --git a/ports/pic18f6720/18F6720.lkr b/ports/pic18f6720/18F6720.lkr deleted file mode 100644 index 18c3fd41..00000000 --- a/ports/pic18f6720/18F6720.lkr +++ /dev/null @@ -1,41 +0,0 @@ -// $Id: 18f6720.lkr,v 1.1 2003/12/16 14:53:08 GrosbaJ Exp $ -// File: 18f6720.lkr -// Sample linker script for the PIC18F6720 processor - -LIBPATH . - -FILES c018i.o -FILES clib.lib -FILES p18F6720.lib - -CODEPAGE NAME=vectors START=0x0 END=0x29 PROTECTED -CODEPAGE NAME=page START=0x2A END=0x1FFFF -CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED -CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED -CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED -CODEPAGE NAME=eedata START=0xF00000 END=0xF003FF PROTECTED - -ACCESSBANK NAME=accessram START=0x0 END=0x5F -DATABANK NAME=gpr0 START=0x60 END=0xFF -DATABANK NAME=gpr1 START=0x100 END=0x1FF -DATABANK NAME=gpr2 START=0x200 END=0x2FF -DATABANK NAME=gpr3 START=0x300 END=0x3FF -DATABANK NAME=gpr4 START=0x400 END=0x4FF -DATABANK NAME=gpr5 START=0x500 END=0x5FF -DATABANK NAME=gpr6 START=0x600 END=0x6FF -DATABANK NAME=gpr7 START=0x700 END=0x7FF -DATABANK NAME=gpr8 START=0x800 END=0x8FF -DATABANK NAME=gpr9 START=0x900 END=0x9FF -DATABANK NAME=gpr10 START=0xA00 END=0xAFF -DATABANK NAME=gpr11 START=0xB00 END=0xBFF -//DATABANK NAME=gpr12 START=0xC00 END=0xCFF -//DATABANK NAME=gpr13 START=0xD00 END=0xDFF -DATABANK NAME=stackreg START=0xC00 END=0xDFF PROTECTED -DATABANK NAME=gpr14 START=0xE00 END=0xEF3 -DATABANK NAME=dbgspr START=0xEF4 END=0xEFF PROTECTED -ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED - -SECTION NAME=CONFIG ROM=config - -//STACK SIZE=0x100 RAM=gpr13 -STACK SIZE=0x200 RAM=stackreg diff --git a/ports/pic18f6720/BACnet-Server.X/Makefile b/ports/pic18f6720/BACnet-Server.X/Makefile deleted file mode 100644 index 05a3fb1b..00000000 --- a/ports/pic18f6720/BACnet-Server.X/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -# -# There exist several targets which are by default empty and which can be -# used for execution of your targets. These targets are usually executed -# before and after some main targets. They are: -# -# .build-pre: called before 'build' target -# .build-post: called after 'build' target -# .clean-pre: called before 'clean' target -# .clean-post: called after 'clean' target -# .clobber-pre: called before 'clobber' target -# .clobber-post: called after 'clobber' target -# .all-pre: called before 'all' target -# .all-post: called after 'all' target -# .help-pre: called before 'help' target -# .help-post: called after 'help' target -# -# Targets beginning with '.' are not intended to be called on their own. -# -# Main targets can be executed directly, and they are: -# -# build build a specific configuration -# clean remove built files from a configuration -# clobber remove all built files -# all build all configurations -# help print help mesage -# -# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and -# .help-impl are implemented in nbproject/makefile-impl.mk. -# -# Available make variables: -# -# CND_BASEDIR base directory for relative paths -# CND_DISTDIR default top distribution directory (build artifacts) -# CND_BUILDDIR default top build directory (object files, ...) -# CONF name of current configuration -# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) -# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) -# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) -# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) -# CND_PACKAGE_NAME_${CONF} name of package (current configuration) -# CND_PACKAGE_PATH_${CONF} path to package (current configuration) -# -# NOCDDL - - -# Environment -MKDIR=mkdir -CP=cp -CCADMIN=CCadmin -RANLIB=ranlib - - -# build -build: .build-post - -.build-pre: -# Add your pre 'build' code here... - -.build-post: .build-impl -# Add your post 'build' code here... - - -# clean -clean: .clean-post - -.clean-pre: -# Add your pre 'clean' code here... - -.clean-post: .clean-impl -# Add your post 'clean' code here... - - -# clobber -clobber: .clobber-post - -.clobber-pre: -# Add your pre 'clobber' code here... - -.clobber-post: .clobber-impl -# Add your post 'clobber' code here... - - -# all -all: .all-post - -.all-pre: -# Add your pre 'all' code here... - -.all-post: .all-impl -# Add your post 'all' code here... - - -# help -help: .help-post - -.help-pre: -# Add your pre 'help' code here... - -.help-post: .help-impl -# Add your post 'help' code here... - - - -# include project implementation makefile -include nbproject/Makefile-impl.mk - -# include project make variables -include nbproject/Makefile-variables.mk diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-default.mk b/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-default.mk deleted file mode 100644 index ba5fc384..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-default.mk +++ /dev/null @@ -1,659 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# Edit the Makefile in the project folder instead (../Makefile). Each target -# has a -pre and a -post target defined where you can add customized code. -# -# This makefile implements configuration specific macros and targets. - - -# Include project Makefile -include Makefile -# Include makefile containing local settings -ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" -include nbproject/Makefile-local-default.mk -endif - -# Environment -MKDIR=gnumkdir -p -RM=rm -f -MV=mv -CP=cp - -# Macros -CND_CONF=default -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -IMAGE_TYPE=debug -OUTPUT_SUFFIX=cof -DEBUGGABLE_SUFFIX=cof -FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -else -IMAGE_TYPE=production -OUTPUT_SUFFIX=hex -DEBUGGABLE_SUFFIX=cof -FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -endif - -# Object Directory -OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} - -# Distribution Directory -DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} - -# Object Files Quoted if spaced -OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/1386528437/abort.o ${OBJECTDIR}/_ext/1386528437/bacapp.o ${OBJECTDIR}/_ext/1386528437/bacdcode.o ${OBJECTDIR}/_ext/1386528437/bacerror.o ${OBJECTDIR}/_ext/1386528437/bacstr.o ${OBJECTDIR}/_ext/1386528437/crc.o ${OBJECTDIR}/_ext/1386528437/dcc.o ${OBJECTDIR}/_ext/1386528437/iam.o ${OBJECTDIR}/_ext/1386528437/rd.o ${OBJECTDIR}/_ext/1386528437/reject.o ${OBJECTDIR}/_ext/1386528437/rp.o ${OBJECTDIR}/_ext/1386528437/whois.o ${OBJECTDIR}/_ext/1394255507/h_dcc.o ${OBJECTDIR}/_ext/1394255507/h_rd.o ${OBJECTDIR}/_ext/1472/main.o ${OBJECTDIR}/_ext/1472/dlmstp.o ${OBJECTDIR}/_ext/1472/device.o ${OBJECTDIR}/_ext/1472/rs485.o ${OBJECTDIR}/_ext/1472/isr.o ${OBJECTDIR}/_ext/1386528437/datetime.o ${OBJECTDIR}/_ext/1394255507/txbuf.o ${OBJECTDIR}/_ext/1394255507/h_whois.o ${OBJECTDIR}/_ext/1472/mstp.o ${OBJECTDIR}/_ext/1472/bv.o ${OBJECTDIR}/_ext/1472/ai.o ${OBJECTDIR}/_ext/1472/bi.o ${OBJECTDIR}/_ext/1472/av.o ${OBJECTDIR}/_ext/1386528437/wp.o ${OBJECTDIR}/_ext/1394255507/h_npdu.o ${OBJECTDIR}/_ext/1394255507/s_iam.o ${OBJECTDIR}/_ext/1386528437/bacreal.o ${OBJECTDIR}/_ext/1386528437/bacint.o ${OBJECTDIR}/_ext/1386528437/npdu.o ${OBJECTDIR}/_ext/1472/apdu.o ${OBJECTDIR}/_ext/1394255507/noserv.o ${OBJECTDIR}/_ext/1386528437/fifo.o ${OBJECTDIR}/_ext/1394255507/h_rp.o ${OBJECTDIR}/_ext/1394255507/h_wp.o ${OBJECTDIR}/_ext/1386528437/bacaddr.o -POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/1386528437/abort.o.d ${OBJECTDIR}/_ext/1386528437/bacapp.o.d ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d ${OBJECTDIR}/_ext/1386528437/bacerror.o.d ${OBJECTDIR}/_ext/1386528437/bacstr.o.d ${OBJECTDIR}/_ext/1386528437/crc.o.d ${OBJECTDIR}/_ext/1386528437/dcc.o.d ${OBJECTDIR}/_ext/1386528437/iam.o.d ${OBJECTDIR}/_ext/1386528437/rd.o.d ${OBJECTDIR}/_ext/1386528437/reject.o.d ${OBJECTDIR}/_ext/1386528437/rp.o.d ${OBJECTDIR}/_ext/1386528437/whois.o.d ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d ${OBJECTDIR}/_ext/1394255507/h_rd.o.d ${OBJECTDIR}/_ext/1472/main.o.d ${OBJECTDIR}/_ext/1472/dlmstp.o.d ${OBJECTDIR}/_ext/1472/device.o.d ${OBJECTDIR}/_ext/1472/rs485.o.d ${OBJECTDIR}/_ext/1472/isr.o.d ${OBJECTDIR}/_ext/1386528437/datetime.o.d ${OBJECTDIR}/_ext/1394255507/txbuf.o.d ${OBJECTDIR}/_ext/1394255507/h_whois.o.d ${OBJECTDIR}/_ext/1472/mstp.o.d ${OBJECTDIR}/_ext/1472/bv.o.d ${OBJECTDIR}/_ext/1472/ai.o.d ${OBJECTDIR}/_ext/1472/bi.o.d ${OBJECTDIR}/_ext/1472/av.o.d ${OBJECTDIR}/_ext/1386528437/wp.o.d ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d ${OBJECTDIR}/_ext/1394255507/s_iam.o.d ${OBJECTDIR}/_ext/1386528437/bacreal.o.d ${OBJECTDIR}/_ext/1386528437/bacint.o.d ${OBJECTDIR}/_ext/1386528437/npdu.o.d ${OBJECTDIR}/_ext/1472/apdu.o.d ${OBJECTDIR}/_ext/1394255507/noserv.o.d ${OBJECTDIR}/_ext/1386528437/fifo.o.d ${OBJECTDIR}/_ext/1394255507/h_rp.o.d ${OBJECTDIR}/_ext/1394255507/h_wp.o.d ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - -# Object Files -OBJECTFILES=${OBJECTDIR}/_ext/1386528437/abort.o ${OBJECTDIR}/_ext/1386528437/bacapp.o ${OBJECTDIR}/_ext/1386528437/bacdcode.o ${OBJECTDIR}/_ext/1386528437/bacerror.o ${OBJECTDIR}/_ext/1386528437/bacstr.o ${OBJECTDIR}/_ext/1386528437/crc.o ${OBJECTDIR}/_ext/1386528437/dcc.o ${OBJECTDIR}/_ext/1386528437/iam.o ${OBJECTDIR}/_ext/1386528437/rd.o ${OBJECTDIR}/_ext/1386528437/reject.o ${OBJECTDIR}/_ext/1386528437/rp.o ${OBJECTDIR}/_ext/1386528437/whois.o ${OBJECTDIR}/_ext/1394255507/h_dcc.o ${OBJECTDIR}/_ext/1394255507/h_rd.o ${OBJECTDIR}/_ext/1472/main.o ${OBJECTDIR}/_ext/1472/dlmstp.o ${OBJECTDIR}/_ext/1472/device.o ${OBJECTDIR}/_ext/1472/rs485.o ${OBJECTDIR}/_ext/1472/isr.o ${OBJECTDIR}/_ext/1386528437/datetime.o ${OBJECTDIR}/_ext/1394255507/txbuf.o ${OBJECTDIR}/_ext/1394255507/h_whois.o ${OBJECTDIR}/_ext/1472/mstp.o ${OBJECTDIR}/_ext/1472/bv.o ${OBJECTDIR}/_ext/1472/ai.o ${OBJECTDIR}/_ext/1472/bi.o ${OBJECTDIR}/_ext/1472/av.o ${OBJECTDIR}/_ext/1386528437/wp.o ${OBJECTDIR}/_ext/1394255507/h_npdu.o ${OBJECTDIR}/_ext/1394255507/s_iam.o ${OBJECTDIR}/_ext/1386528437/bacreal.o ${OBJECTDIR}/_ext/1386528437/bacint.o ${OBJECTDIR}/_ext/1386528437/npdu.o ${OBJECTDIR}/_ext/1472/apdu.o ${OBJECTDIR}/_ext/1394255507/noserv.o ${OBJECTDIR}/_ext/1386528437/fifo.o ${OBJECTDIR}/_ext/1394255507/h_rp.o ${OBJECTDIR}/_ext/1394255507/h_wp.o ${OBJECTDIR}/_ext/1386528437/bacaddr.o - - -CFLAGS= -ASFLAGS= -LDLIBSOPTIONS= - -############# Tool locations ########################################## -# If you copy a project from one host to another, the path where the # -# compiler is installed may be different. # -# If you open this project with MPLAB X in the new host, this # -# makefile will be regenerated and the paths will be corrected. # -####################################################################### -# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build -FIXDEPS=fixDeps - -.build-conf: ${BUILD_SUBPROJECTS} - ${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} - -MP_PROCESSOR_OPTION=18F6720 -MP_PROCESSOR_OPTION_LD=18f6720 -MP_LINKER_DEBUG_OPTION= -u_DEBUGCODESTART=0x1fd30 -u_DEBUGCODELEN=0x2d0 -u_DEBUGDATASTART=0xef4 -u_DEBUGDATALEN=0xb -# ------------------------------------------------------------------------------------ -# Rules for buildStep: assemble -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -else -endif - -# ------------------------------------------------------------------------------------ -# Rules for buildStep: compile -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -${OBJECTDIR}/_ext/1386528437/abort.o: ../../../src/abort.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/abort.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/abort.o ../../../src/abort.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/abort.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/abort.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacapp.o: ../../../src/bacapp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacapp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacapp.o ../../../src/bacapp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacapp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacapp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacdcode.o: ../../../src/bacdcode.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacdcode.o ../../../src/bacdcode.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacdcode.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacdcode.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacerror.o: ../../../src/bacerror.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacerror.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacerror.o ../../../src/bacerror.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacerror.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacerror.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacstr.o: ../../../src/bacstr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacstr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacstr.o ../../../src/bacstr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacstr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacstr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/crc.o: ../../../src/crc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/crc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/crc.o ../../../src/crc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/crc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/crc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/dcc.o: ../../../src/dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/dcc.o ../../../src/dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/iam.o: ../../../src/iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/iam.o ../../../src/iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rd.o: ../../../src/rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rd.o ../../../src/rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/reject.o: ../../../src/reject.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/reject.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/reject.o ../../../src/reject.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/reject.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/reject.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rp.o: ../../../src/rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rp.o ../../../src/rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/whois.o: ../../../src/whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/whois.o ../../../src/whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_dcc.o: ../../../demo/handler/h_dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_dcc.o ../../../demo/handler/h_dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rd.o: ../../../demo/handler/h_rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rd.o ../../../demo/handler/h_rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/main.o: ../main.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/main.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/main.o ../main.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/main.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/dlmstp.o: ../dlmstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/dlmstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/dlmstp.o ../dlmstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/dlmstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/dlmstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/device.o: ../device.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/device.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/device.o ../device.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/device.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/device.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/rs485.o: ../rs485.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/rs485.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/rs485.o ../rs485.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/rs485.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/rs485.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/isr.o: ../isr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/isr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/isr.o ../isr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/isr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/isr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/datetime.o: ../../../src/datetime.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/datetime.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/datetime.o ../../../src/datetime.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/datetime.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/datetime.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/txbuf.o: ../../../demo/handler/txbuf.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/txbuf.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/txbuf.o ../../../demo/handler/txbuf.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/txbuf.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/txbuf.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_whois.o: ../../../demo/handler/h_whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_whois.o ../../../demo/handler/h_whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/mstp.o: ../mstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/mstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/mstp.o ../mstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/mstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/mstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bv.o: ../bv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bv.o ../bv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/ai.o: ../ai.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/ai.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/ai.o ../ai.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/ai.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/ai.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bi.o: ../bi.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bi.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bi.o ../bi.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bi.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bi.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/av.o: ../av.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/av.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/av.o ../av.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/av.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/av.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/wp.o: ../../../src/wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/wp.o ../../../src/wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_npdu.o: ../../../demo/handler/h_npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_npdu.o ../../../demo/handler/h_npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/s_iam.o: ../../../demo/handler/s_iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/s_iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/s_iam.o ../../../demo/handler/s_iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/s_iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/s_iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacreal.o: ../../../src/bacreal.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacreal.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacreal.o ../../../src/bacreal.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacreal.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacreal.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacint.o: ../../../src/bacint.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacint.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacint.o ../../../src/bacint.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacint.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacint.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/npdu.o: ../../../src/npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/npdu.o ../../../src/npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/apdu.o: ../apdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/apdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/apdu.o ../apdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/apdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/apdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/noserv.o: ../../../demo/handler/noserv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/noserv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/noserv.o ../../../demo/handler/noserv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/noserv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/noserv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/fifo.o: ../../../src/fifo.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/fifo.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/fifo.o ../../../src/fifo.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/fifo.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/fifo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rp.o: ../../../demo/handler/h_rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rp.o ../../../demo/handler/h_rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_wp.o: ../../../demo/handler/h_wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_wp.o ../../../demo/handler/h_wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacaddr.o: ../../../src/bacaddr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacaddr.o ../../../src/bacaddr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacaddr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacaddr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -else -${OBJECTDIR}/_ext/1386528437/abort.o: ../../../src/abort.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/abort.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/abort.o ../../../src/abort.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/abort.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/abort.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacapp.o: ../../../src/bacapp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacapp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacapp.o ../../../src/bacapp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacapp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacapp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacdcode.o: ../../../src/bacdcode.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacdcode.o ../../../src/bacdcode.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacdcode.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacdcode.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacerror.o: ../../../src/bacerror.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacerror.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacerror.o ../../../src/bacerror.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacerror.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacerror.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacstr.o: ../../../src/bacstr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacstr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacstr.o ../../../src/bacstr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacstr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacstr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/crc.o: ../../../src/crc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/crc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/crc.o ../../../src/crc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/crc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/crc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/dcc.o: ../../../src/dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/dcc.o ../../../src/dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/iam.o: ../../../src/iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/iam.o ../../../src/iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rd.o: ../../../src/rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rd.o ../../../src/rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/reject.o: ../../../src/reject.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/reject.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/reject.o ../../../src/reject.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/reject.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/reject.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rp.o: ../../../src/rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rp.o ../../../src/rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/whois.o: ../../../src/whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/whois.o ../../../src/whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_dcc.o: ../../../demo/handler/h_dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_dcc.o ../../../demo/handler/h_dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rd.o: ../../../demo/handler/h_rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rd.o ../../../demo/handler/h_rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/main.o: ../main.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/main.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/main.o ../main.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/main.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/dlmstp.o: ../dlmstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/dlmstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/dlmstp.o ../dlmstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/dlmstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/dlmstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/device.o: ../device.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/device.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/device.o ../device.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/device.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/device.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/rs485.o: ../rs485.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/rs485.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/rs485.o ../rs485.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/rs485.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/rs485.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/isr.o: ../isr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/isr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/isr.o ../isr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/isr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/isr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/datetime.o: ../../../src/datetime.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/datetime.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/datetime.o ../../../src/datetime.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/datetime.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/datetime.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/txbuf.o: ../../../demo/handler/txbuf.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/txbuf.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/txbuf.o ../../../demo/handler/txbuf.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/txbuf.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/txbuf.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_whois.o: ../../../demo/handler/h_whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_whois.o ../../../demo/handler/h_whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/mstp.o: ../mstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/mstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/mstp.o ../mstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/mstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/mstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bv.o: ../bv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bv.o ../bv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/ai.o: ../ai.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/ai.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/ai.o ../ai.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/ai.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/ai.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bi.o: ../bi.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bi.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bi.o ../bi.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bi.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bi.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/av.o: ../av.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/av.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/av.o ../av.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/av.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/av.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/wp.o: ../../../src/wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/wp.o ../../../src/wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_npdu.o: ../../../demo/handler/h_npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_npdu.o ../../../demo/handler/h_npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/s_iam.o: ../../../demo/handler/s_iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/s_iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/s_iam.o ../../../demo/handler/s_iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/s_iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/s_iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacreal.o: ../../../src/bacreal.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacreal.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacreal.o ../../../src/bacreal.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacreal.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacreal.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacint.o: ../../../src/bacint.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacint.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacint.o ../../../src/bacint.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacint.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacint.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/npdu.o: ../../../src/npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/npdu.o ../../../src/npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/apdu.o: ../apdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/apdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/apdu.o ../apdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/apdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/apdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/noserv.o: ../../../demo/handler/noserv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/noserv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/noserv.o ../../../demo/handler/noserv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/noserv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/noserv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/fifo.o: ../../../src/fifo.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/fifo.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/fifo.o ../../../src/fifo.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/fifo.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/fifo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rp.o: ../../../demo/handler/h_rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rp.o ../../../demo/handler/h_rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_wp.o: ../../../demo/handler/h_wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_wp.o ../../../demo/handler/h_wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacaddr.o: ../../../src/bacaddr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacaddr.o ../../../src/bacaddr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacaddr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacaddr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -endif - -# ------------------------------------------------------------------------------------ -# Rules for buildStep: link -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION_LD) -w -x -u_DEBUG -z__MPLAB_BUILD=1 -u_CRUNTIME -z__MPLAB_DEBUG=1 -z__MPLAB_DEBUGGER_ICD3=1 $(MP_LINKER_DEBUG_OPTION) -l ${MP_CC_DIR}\\..\\lib -o dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -else -dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION_LD) -w -z__MPLAB_BUILD=1 -u_CRUNTIME -l ${MP_CC_DIR}\\..\\lib -o dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -endif - - -# Subprojects -.build-subprojects: - - -# Subprojects -.clean-subprojects: - -# Clean Targets -.clean-conf: ${CLEAN_SUBPROJECTS} - ${RM} -r build/default - ${RM} -r dist/default - -# Enable dependency checking -.dep.inc: .depcheck-impl - -DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) -ifneq (${DEPFILES},) -include ${DEPFILES} -endif diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-genesis.properties b/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-genesis.properties deleted file mode 100644 index b3bd2089..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-genesis.properties +++ /dev/null @@ -1,6 +0,0 @@ -# -#Sun Aug 22 10:50:21 CDT 2021 -configurations-xml=76d5fe9d80d284cbe317219a22001b30 -com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=9db8f8a224aa17d0023ea7f468f871dc -host.platform=linux -conf.ids= diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-impl.mk b/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-impl.mk deleted file mode 100644 index cfa87f01..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-impl.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# Edit the Makefile in the project folder instead (../Makefile). Each target -# has a pre- and a post- target defined where you can add customization code. -# -# This makefile implements macros and targets common to all configurations. -# -# NOCDDL - - -# Building and Cleaning subprojects are done by default, but can be controlled with the SUB -# macro. If SUB=no, subprojects will not be built or cleaned. The following macro -# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf -# and .clean-reqprojects-conf unless SUB has the value 'no' -SUB_no=NO -SUBPROJECTS=${SUB_${SUB}} -BUILD_SUBPROJECTS_=.build-subprojects -BUILD_SUBPROJECTS_NO= -BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} -CLEAN_SUBPROJECTS_=.clean-subprojects -CLEAN_SUBPROJECTS_NO= -CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} - - -# Project Name -PROJECTNAME=BACnet-Server.X - -# Active Configuration -DEFAULTCONF=default -CONF=${DEFAULTCONF} - -# All Configurations -ALLCONFS=default - - -# build -.build-impl: .build-pre - ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf - - -# clean -.clean-impl: .clean-pre - ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf - -# clobber -.clobber-impl: .clobber-pre .depcheck-impl - ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean - - - -# all -.all-impl: .all-pre .depcheck-impl - ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build - - - -# dependency checking support -.depcheck-impl: -# @echo "# This code depends on make tool being used" >.dep.inc -# @if [ -n "${MAKE_VERSION}" ]; then \ -# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ -# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ -# echo "include \$${DEPFILES}" >>.dep.inc; \ -# echo "endif" >>.dep.inc; \ -# else \ -# echo ".KEEP_STATE:" >>.dep.inc; \ -# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ -# fi diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-local-default.mk b/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-local-default.mk deleted file mode 100644 index 715a50f6..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-local-default.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# -# This file contains information about the location of compilers and other tools. -# If you commmit this file into your revision control server, you will be able to -# to checkout the project and build it from the command line with make. However, -# if more than one person works on the same project, then this file might show -# conflicts since different users are bound to have compilers in different places. -# In that case you might choose to not commit this file and let MPLAB X recreate this file -# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at -# least once so the file gets created and the project can be built. Finally, you can also -# avoid using this file at all if you are only building from the command line with make. -# You can invoke make with the values of the macros: -# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... -# -SHELL=cmd.exe -PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/ -# Adding MPLAB X bin directory to path. -PATH:=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/:$(PATH) -# Path to java used to run MPLAB X when this makefile was created -MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.6.0_32-windows-x64\java-windows/bin/" -OS_CURRENT="$(shell uname -s)" -MP_CC="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mcc18.exe" -# MP_CPPC is not defined -# MP_BC is not defined -MP_AS="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm\MPASMWIN.exe" -MP_LD="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplink.exe" -MP_AR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplib.exe" -DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" -MP_CC_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -# MP_CPPC_DIR is not defined -# MP_BC_DIR is not defined -MP_AS_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm" -MP_LD_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -MP_AR_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -# MP_BC_DIR is not defined diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-variables.mk b/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-variables.mk deleted file mode 100644 index 204009b0..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Makefile-variables.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Generated - do not edit! -# -# NOCDDL -# -CND_BASEDIR=`pwd` -# default configuration -CND_ARTIFACT_DIR_default=dist/default/production -CND_ARTIFACT_NAME_default=BACnet-Server.X.production.hex -CND_ARTIFACT_PATH_default=dist/default/production/BACnet-Server.X.production.hex -CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package -CND_PACKAGE_NAME_default=bacnet-server.x.tar -CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/bacnet-server.x.tar diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/Package-default.bash b/ports/pic18f6720/BACnet-Server.X/nbproject/Package-default.bash deleted file mode 100755 index fe987452..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/Package-default.bash +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -x - -# -# Generated - do not edit! -# - -# Macros -TOP=`pwd` -CND_CONF=default -CND_DISTDIR=dist -TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging -TMPDIRNAME=tmp-packaging -OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -OUTPUT_BASENAME=BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -PACKAGE_TOP_DIR=bacnet-server.x/ - -# Functions -function checkReturnCode -{ - rc=$? - if [ $rc != 0 ] - then - exit $rc - fi -} -function makeDirectory -# $1 directory path -# $2 permission (optional) -{ - mkdir -p "$1" - checkReturnCode - if [ "$2" != "" ] - then - chmod $2 "$1" - checkReturnCode - fi -} -function copyFileToTmpDir -# $1 from-file path -# $2 to-file path -# $3 permission -{ - cp "$1" "$2" - checkReturnCode - if [ "$3" != "" ] - then - chmod $3 "$2" - checkReturnCode - fi -} - -# Setup -cd "${TOP}" -mkdir -p ${CND_DISTDIR}/${CND_CONF}/package -rm -rf ${TMPDIR} -mkdir -p ${TMPDIR} - -# Copy files and create directories and links -cd "${TOP}" -makeDirectory ${TMPDIR}/bacnet-server.x/bin -copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 - - -# Generate tar file -cd "${TOP}" -rm -f ${CND_DISTDIR}/${CND_CONF}/package/bacnet-server.x.tar -cd ${TMPDIR} -tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/bacnet-server.x.tar * -checkReturnCode - -# Cleanup -cd "${TOP}" -rm -rf ${TMPDIR} diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/configurations.xml b/ports/pic18f6720/BACnet-Server.X/nbproject/configurations.xml deleted file mode 100644 index af276e1d..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/configurations.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - - ../stdbool.h - ../stdint.h - ../rs485.h - ../mstp.h - ../../../include/bits.h - ../../../include/abort.h - ../../../include/apdu.h - ../../../include/bacaddr.h - ../../../include/bacapp.h - ../../../include/bacdcode.h - ../../../include/bacdef.h - ../../../include/bacenum.h - ../../../include/bacerror.h - ../../../include/bacint.h - ../../../include/bacprop.h - ../../../include/bacreal.h - ../../../include/bacstr.h - ../../../include/bigend.h - ../../../include/config.h - ../hardware.h - - - - - ../../../src/abort.c - ../../../src/bacapp.c - ../../../src/bacdcode.c - ../../../src/bacerror.c - ../../../src/bacstr.c - ../../../src/crc.c - ../../../src/dcc.c - ../../../src/iam.c - ../../../src/rd.c - ../../../src/reject.c - ../../../src/rp.c - ../../../src/whois.c - ../../../demo/handler/h_dcc.c - ../../../demo/handler/h_rd.c - ../main.c - ../dlmstp.c - ../device.c - ../rs485.c - ../isr.c - ../../../src/datetime.c - ../../../demo/handler/txbuf.c - ../../../demo/handler/h_whois.c - ../mstp.c - ../bv.c - ../ai.c - ../bi.c - ../av.c - ../../../src/wp.c - ../../../demo/handler/h_npdu.c - ../../../demo/handler/s_iam.c - ../../../src/bacreal.c - ../../../src/bacint.c - ../../../src/npdu.c - ../apdu.c - ../../../demo/handler/noserv.c - ../../../src/fifo.c - ../../../demo/handler/h_rp.c - ../../../demo/handler/h_wp.c - ../../../src/bacaddr.c - - - Makefile - - - - ../ - - Makefile - - - - localhost - PIC18F6720 - - - ICD3PlatformTool - C18 - 3.40 - 3 - - - - - - - - - - - - - - - false - false - - - - - - - false - - false - - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/project.properties b/ports/pic18f6720/BACnet-Server.X/nbproject/project.properties deleted file mode 100644 index e69de29b..00000000 diff --git a/ports/pic18f6720/BACnet-Server.X/nbproject/project.xml b/ports/pic18f6720/BACnet-Server.X/nbproject/project.xml deleted file mode 100644 index 12dadd53..00000000 --- a/ports/pic18f6720/BACnet-Server.X/nbproject/project.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - com.microchip.mplab.nbide.embedded.makeproject - - - BACnet-Server - e54ca906-513b-4f74-a23b-6b0204c4509a - 0 - c - - h - ISO-8859-1 - - - - ../ - - - - default - 2 - - - - false - - - - diff --git a/ports/pic18f6720/BACnet-Server.mcp b/ports/pic18f6720/BACnet-Server.mcp deleted file mode 100644 index f3ff4c4a..00000000 --- a/ports/pic18f6720/BACnet-Server.mcp +++ /dev/null @@ -1,282 +0,0 @@ -[HEADER] -magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13} -file_version=1.0 -device=PIC18F6720 -[PATH_INFO] -BuildDirPolicy=BuildDirIsSourceDir -dir_src= -dir_bin= -dir_tmp= -dir_sin= -dir_inc=C:\code\bacnet-stack\include;C:\code\bacnet-stack\demo\object;C:\code\bacnet-stack\ports\pic18f6720 -dir_lib=C:\mcc18\lib -dir_lkr= -[CAT_FILTERS] -filter_src=*.asm;*.c -filter_inc=*.h;*.inc -filter_obj=*.o -filter_lib=*.lib -filter_lkr=*.lkr -[CAT_SUBFOLDERS] -subfolder_src= -subfolder_inc= -subfolder_obj= -subfolder_lib= -subfolder_lkr= -[FILE_SUBFOLDERS] -file_000=. -file_001=. -file_002=. -file_003=. -file_004=. -file_005=. -file_006=. -file_007=. -file_008=. -file_009=. -file_010=. -file_011=. -file_012=. -file_013=. -file_014=. -file_015=. -file_016=. -file_017=. -file_018=. -file_019=. -file_020=. -file_021=. -file_022=. -file_023=. -file_024=. -file_025=. -file_026=. -file_027=. -file_028=. -file_029=. -file_030=. -file_031=. -file_032=. -file_033=. -file_034=. -file_035=. -file_036=. -file_037=. -file_038=. -file_039=. -file_040=. -file_041=. -file_042=. -file_043=. -file_044=. -file_045=. -file_046=. -file_047=. -file_048=. -file_049=. -file_050=. -file_051=. -file_052=. -file_053=. -file_054=. -file_055=. -file_056=. -file_057=. -file_058=. -[GENERATED_FILES] -file_000=no -file_001=no -file_002=no -file_003=no -file_004=no -file_005=no -file_006=no -file_007=no -file_008=no -file_009=no -file_010=no -file_011=no -file_012=no -file_013=no -file_014=no -file_015=no -file_016=no -file_017=no -file_018=no -file_019=no -file_020=no -file_021=no -file_022=no -file_023=no -file_024=no -file_025=no -file_026=no -file_027=no -file_028=no -file_029=no -file_030=no -file_031=no -file_032=no -file_033=no -file_034=no -file_035=no -file_036=no -file_037=no -file_038=no -file_039=no -file_040=no -file_041=no -file_042=no -file_043=no -file_044=no -file_045=no -file_046=no -file_047=no -file_048=no -file_049=no -file_050=no -file_051=no -file_052=no -file_053=no -file_054=no -file_055=no -file_056=no -file_057=no -file_058=no -[OTHER_FILES] -file_000=no -file_001=no -file_002=no -file_003=no -file_004=no -file_005=no -file_006=no -file_007=no -file_008=no -file_009=no -file_010=no -file_011=no -file_012=no -file_013=no -file_014=no -file_015=no -file_016=no -file_017=no -file_018=no -file_019=no -file_020=no -file_021=no -file_022=no -file_023=no -file_024=no -file_025=no -file_026=no -file_027=no -file_028=no -file_029=no -file_030=no -file_031=no -file_032=no -file_033=no -file_034=no -file_035=no -file_036=no -file_037=no -file_038=no -file_039=no -file_040=no -file_041=no -file_042=no -file_043=no -file_044=no -file_045=no -file_046=no -file_047=no -file_048=no -file_049=no -file_050=no -file_051=no -file_052=no -file_053=no -file_054=no -file_055=no -file_056=no -file_057=no -file_058=no -[FILE_INFO] -file_000=C:\code\bacnet-stack\src\abort.c -file_001=C:\code\bacnet-stack\src\bacapp.c -file_002=C:\code\bacnet-stack\src\bacdcode.c -file_003=C:\code\bacnet-stack\src\bacerror.c -file_004=C:\code\bacnet-stack\src\bacstr.c -file_005=C:\code\bacnet-stack\src\crc.c -file_006=C:\code\bacnet-stack\src\dcc.c -file_007=C:\code\bacnet-stack\src\iam.c -file_008=C:\code\bacnet-stack\src\rd.c -file_009=C:\code\bacnet-stack\src\reject.c -file_010=C:\code\bacnet-stack\src\rp.c -file_011=C:\code\bacnet-stack\src\whois.c -file_012=C:\code\bacnet-stack\demo\handler\h_dcc.c -file_013=C:\code\bacnet-stack\demo\handler\h_rd.c -file_014=main.c -file_015=dlmstp.c -file_016=device.c -file_017=rs485.c -file_018=isr.c -file_019=C:\code\bacnet-stack\src\datetime.c -file_020=C:\code\bacnet-stack\demo\handler\txbuf.c -file_021=C:\code\bacnet-stack\demo\handler\h_whois.c -file_022=mstp.c -file_023=bv.c -file_024=ai.c -file_025=bi.c -file_026=av.c -file_027=C:\code\bacnet-stack\src\wp.c -file_028=C:\code\bacnet-stack\demo\handler\h_npdu.c -file_029=C:\code\bacnet-stack\demo\handler\s_iam.c -file_030=C:\code\bacnet-stack\src\bacreal.c -file_031=C:\code\bacnet-stack\src\bacint.c -file_032=C:\code\bacnet-stack\src\npdu.c -file_033=apdu.c -file_034=C:\code\bacnet-stack\demo\handler\noserv.c -file_035=C:\code\bacnet-stack\src\fifo.c -file_036=C:\code\bacnet-stack\demo\handler\h_wp.c -file_037=C:\code\bacnet-stack\demo\handler\h_rp.c -file_038=C:\code\bacnet-stack\src\bacaddr.c -file_039=stdbool.h -file_040=stdint.h -file_041=rs485.h -file_042=mstp.h -file_043=C:\code\bacnet-stack\include\bits.h -file_044=C:\code\bacnet-stack\include\abort.h -file_045=C:\code\bacnet-stack\include\apdu.h -file_046=C:\code\bacnet-stack\include\bacaddr.h -file_047=C:\code\bacnet-stack\include\bacapp.h -file_048=C:\code\bacnet-stack\include\bacdcode.h -file_049=C:\code\bacnet-stack\include\bacdef.h -file_050=C:\code\bacnet-stack\include\bacenum.h -file_051=C:\code\bacnet-stack\include\bacerror.h -file_052=C:\code\bacnet-stack\include\bacint.h -file_053=C:\code\bacnet-stack\include\bacprop.h -file_054=C:\code\bacnet-stack\include\bacreal.h -file_055=C:\code\bacnet-stack\include\bacstr.h -file_056=C:\code\bacnet-stack\include\bigend.h -file_057=C:\code\bacnet-stack\include\config.h -file_058=18F6720.lkr -[SUITE_INFO] -suite_guid={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -suite_state= -[TOOL_SETTINGS] -TS{DD2213A8-6310-47B1-8376-9430CDFC013F}= -TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/m"$(BINDIR_)$(TARGETBASE).map" /o"$(TARGETBASE).cof" -TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}=-DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -mL -Ls -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}= -[INSTRUMENTED_TRACE] -enable=0 -transport=0 -format=0 -[CUSTOM_BUILD] -Pre-Build= -Pre-BuildEnabled=1 -Post-Build= -Post-BuildEnabled=1 diff --git a/ports/pic18f6720/BACnet-Server.mcw b/ports/pic18f6720/BACnet-Server.mcw deleted file mode 100644 index feb9cc5df3eb9f7833fb2921a05815f36190f092..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57344 zcmeHQ3z!tum98F!ha*uOP!SPF;wo8{%!3&Q1!Z2qtPHd>&BM%)q3Ed@TY9?N?jB~) ziDK|ANdPr*HyH5^qVW+oan)VLps4Y|8scNuZo5vTwL}mZ~-m0$Zp6;nC z5K|^~=Q~qXx9&Ojo^$U#_uNxmr}n&Z)V|vun)F{vPC8o|p?tFcFlCe_KY(+BNaGZx z2q%P3_V3>>GZh7=e)=3q;A6CveLM?L3>XO*0~ihXTfk|662Rerv4AfCjsP49zz|T5 z0+a&A1112D1{?!87BCTT9AFaQc)(=934kep69Hv_lK@izUj&>C_#40}fKvg}0AB)B z1EvE`2b=-;GN1}j4yXVu1Iz$i0H^_QJkG?i7I3D1eHMR5o6TKJ|8ZX^_;I=^yEu{5h(N&I}+(D%3{>nrD*tnAn6EbAftXB zozh^RGc|zwUL}G5F|>gaXi-!gRi(#Ko2DK>{Q=awm6HvL^~aQMC4%}|P-8Ey-Sokv z1E`<#lyjJgbFT=%J~8G$^#SKU^}t~Or}LjHuT@bN=R={|(4*1h5^P|3-U^`Oj<4{}#X^z+ylU za2}u)&;|$rmH?IlsFQN%e+Tkb0KN+71gr$8fK`AnpbMY@x&b`^>az&oLcnT36wnKx zPKW~%fQtZ}IVnII&74mf+d)i{q9zP8N79v$?pOww9p&J^W{rChi)h~vrOJ)PulFxUS>wKOEQZWhy*X*{*jG;&JnOAVoPNsqNB8!#zd7!h9>sAT=+uthG+6d~DWi!f zGyXwE`4IT0J@i_?QI>LP!Zl?;{mgz{F#2d^;$fZ2T)@DXPG!faO@k1Xkjv>O$+q#j zxMjOC0D6lKD--kKWSj?Xoiw5D@7AXR9iV$2&dCesDeuiG-ZW^;qr1~5h&<+R z>^oYFhY)by8C@pwKLWkO*bf{iIzKGSey~kbOO9NR3BUiT{rmRMwJklQ0Q+FsK#+>z2s*{-LhT@K6cMX@3UxOy(sUf(2ogN#9@@p zH+SCpos=(WF-=58$FQM!(n4rjRp{d`tbY+`+yvGc73&696#FzqDGE$NF_P!_w8xMd zc&}b?G3uk;H4k-1aptU6vz7^{ne`gUyi@pWK5lWSFg2piRaiB99NK#l%luC*Gy#{a zf3lgKb+&HW{fDo8;@N;<|5|SzeEshE=l+asW~zrq)X?9n(GPL-0WDxReK7F=#=+ur$mj+WtMbc9V`#0s+#a z+Tk8KUmC9e55E4Q0Qnw^ikyW4b*xguv_4a5HN3hb5l^O59f?S|qPDwcW@ULtu5FrFcT$0BTiQaw&LHrW zU_bdHzp$>94S|5@_YJUjW_KKiF59BCw*(i~)t}Ma&{(;mWSN?bMPfaT5j7g`S*UfV z=Ty(C%+3wP6LV(NR+lWSYYTNQty?&!JagLIsAnu{TBe@`TNlsoY!IdDy1J5DD%BM0 znp0a>Elr#;bwPZ|J0^a(((-8l~sQbvAd&Xt(7gt{udhyx7x@*T?!=sVUqm2KUM%`{B z??@`8h<{_$&!d%gq4O`|2IIvrtu?}eG&LbuNeg0!WJe1z!j25N5lqH=l4`FJM=dgUdA<@6VnAMb1HpoRf#WCF-|*Cb1o~R8 zdiu><*DoD2je!vx>blm{2N6>xos37LT5?5+h#OO0!ay76A*E#zmPJVwc9FF@ zaV~2!d&cY+w8!X?icF7GmCtk4BdNMrm)0dZC)K81)ThP5@{;0cTBF6%EeNMHXQmh( zVU7+lwnU~JG9ptD&|?gVb2Ph8!&xpFh;0ZJBM-%cCXJv$BBvpF2<^C6oU zX8gGj;(x`l`Z4OM^ThaPjITv~$*6t8J*_Rc)u=x>Zo>^}b8@o19~|1Bg|{e*~M+sMYcOydq<{biiMgbYfS74x|a z(SuWn#mC6gWr#qoinxS~2wXUw0{N2{Mw?|H)5D(e&b2eQDyv@6S9r^kY1Spt%S+mp8T89R-Mp&E)U|AJthFzO z%f<$&f20wFb_zB=1*Kje%q$z!It^+f-It`c#|`Tu@+l~Pv!<+yvgzHBi62Qlu@|_nv3|y zL*r_*j*p->2*pq&zeFHcqu%u-kGws4?ATmB_Ux4!^Jv)&p;M`grlH`h0yxxB)|4CH z*=+zsZW!LtWu`a7@qzp}j~zW!cDXUh`4xjT*fEB2lo2v-I${FipEI`c8>6?2*v8b; z+m_#S1ZA-2*QLrM)uW2GRgDtT+JNgzwzc+uc>bs&wv92|S>`@K=k`_+%aZxbdvL_4 zA_I39u9+x%(t1(9W_;xbXYCq$v)+dPvE)BD;e{g}L_QRN5z5kW{K|@|it?EihTUdF zqCCI=md-;}X117rmaS@5d`;s*-*UC8u^y_@eAx{6ng5OQQ!%~;)*YmZQmK6KLB`FO8hKfgFV-d5iUJIAO%1C3xI?-cd zkmdXv3;Sat@;ELHJ&;pGNtEBI{Sx*^KL3wdKP?`5LHH#Q6?UkzG#U06;~5(|#R(SM zJ611ft>2yHD+$2<%hb&_IH{jn^Km^`bQdhX1Z?gKSi$A6gJS=YPlY*9eNP4Z=Foa7tYg7HKR5}rS5~Z0 zx-|q;hX(7_q)Qnwre}jJ^VZyfbtTsjYfr;N_~VA@r>7JT;twy#9WRA#&49lL`~%>-0Iqts0KNyf z6|fa>8{l@p9e_IlcLDAOaPMoE9z?l^01pFx0C)uOkANQnoZ#Eh|7*CWja4NG6}aWxS~E z^kZ0_0^_n#TN4Ru^MFeaK)cY2iFhQIPOT`x!&Pp|%S%ekwj7Wn7DHXS0?X`ouggz6 zb;L@P=QsNTYn8zBIOZn(v4qIZd`HDVq?Zbwsles5W^)pM{J|eqFeSCH7FnZprqXI! z%TSq~l}(x|$__`9n{;mOnR?X}zKW7d(wa+(t5A|yqLoC;Nmh!jvXxEAWISm$(wggp zqLpv1sda1ANR$s7Op;mIPH58kD?X@)qu!pb=GYoF8tIw`PmzUmYlrxDXg8kRNspuT z8;QN}qwtGP@=h4Uyzh^c-+`09(hK^xD|_Il95F`vNB7i>Dw+>2=;y>HN_-1&u6}(o zzUk8ef97wC9OG1%3mh69&T%RP4viG&IF$m2MvZfvDuF{I z$T`jof%79*IC303>Iz4WgMV^`BgesGu5jcyc-$3^90yOh!KsnsfDf@8%eqF6gMV>_ zBges$u5jcyc*+%y90xmH;mC3Dv@0Ar4u0$kM~;JCu5jcyc*Yfu90$+3!I>$?!ERSL zavVJ83P+9u8g7oq+e|qQUT}pY$H7lr;mC3DqAMIZ4qkGFBgetZu5jcyc*PZt90z;c z;MB@-@UO0L&o5Vdmvn3LZMp9Zh9_vaG_cz9`%7M#qm7Dkj2qQHw3N64Y(>h6Ymh@lPPyWMp_bsK)NHz zUahNhUSBNCVdTJ8t(5bTPN^usk$sDYIOOcxu5jdh{EjOeIUngHbKW+om+4eXUu%Ox*NGyu9DZJ*1W}I97q`q`T6760 zh@V9I{v*!%RS?HmK%q5__l^NDSv^Ij$gR0fC|Xy^EJu+^GAr8&O&9*7gY_Sna_GWy zsiFQUoxXX`N&ESO7DM~D#oEv2lW*(_sV8ds|r-O19vx-mY@X*@QK+_V_?~!`M zhPt(_!c{IF`;{i;0tglQKX{|;Xr&1J%IW05uNUayth8r!`mMwsN zsU@>|H&OV2iYYbSHj>m~E6>b4fAff?^P_&J3k!%_YS&C_3%YRxO=eo71Ca9;vMXwc%!~ zmE$(PiWt^HkzVWkx8{=KfDOl1o!u7iONO-}lPoKnG}pS|ITT;5#d3Hy^GJ=$w$ok? zT@XnP?GtM*DbnLST%U}?{Ye0(MZM}kXC&4g@9gH|2#apXy+g{E0%JJJ))6l7}u z*SkTH*5VazP~@h8TP(-C$UVbVZcyZw;c7Q1a>sCu8x*-=V7EKwMeY}_vq7=$h}$b< z_h0V{NA~{)S2%J2e8Uxv90A{Sg(HW+w_M@KF|g4UjvNG=T;a%3u-O%k90oVI!ja?P zMmIRV|3GQ4^!*3ze}Vo3uB3OknG02N9Ng&&N9u#ST;WK4aJMTQsSoaPg(LOBHa9pk zjN?sbJD*M%LfaOAphpDUahbRW+J)D|g98IEtmH`Mv%ka*Xukbg-Lj@)=M zJ>6oNS$^?u^)K1E9Z@AzOwG{Wuj6+W^0y%O318K=i|`TXC)uCp6A2PWi0ua<#|5r+}MH-EI(c!S9Y#- z$w!{|V>~uLwxXfK?JOi8dEU427$0_zAS54Eo*!4YJL(TS4)M6&wKKJ3e^h&(4?FWu z^5OmU+|DGGe0YC7w=npo0j^xAp>$%;wOY-6U z_1tbNDEaXIdTzHpm3(-AJ-;6fwY3xRQ+cn?^Y1(2!~5$weF66U;r;deK}URee?5Q5 z5g*=P&mVTe2VMv9`aJ(Z0Y3cqt<3kWmIprVcwkXPlx7s^#OEd+m_HuO@o*Y^;-6-G zxa_eI#*Fme$Al0>D#L%TzmIvLtMQOR9J8>}fj4kfXaV^SZY|!{twE%(O2qi;$k7e{ zc=)`%pL?gP@n9c6(tlqYagm`1und1L-`9S8gq!t3>IbkoB!20u5WxGO#Y9=0F3#k6 zZcLK)mf*s=`ZEx2qH;yaGBp{C#CjSdYBb&>zC$pxx-vVL@oQ()R%e2K>ZHY?z1sW! zoJY`7+kIZO_x(9`uXM9R+N-_q&-tOF{_ws($L`g4*&p8b=h(fDFZuAkKgTXafaJsb z{v5lo1(FZ%`*R*gL+$mh_x(9`;T=SOAgqJe{W*3aCnO)-n=z_&|6b zudnC39r5A)_53+Ue0YC7f8G%v-e1pOaKwlA*Ylq^;=}vv`HPPD@cw%Kk|RF6zn;JB zh!5|t=dU>8!~5&`9w&St%$nENbB5}&-AC2_`PXwa^Pm#qe%XHi=!37;CF=40A>(MR zP=5crM||_C7f(d_^(Qxp-yc052*z`fe7GMhEdJlSTAvRXM{AiTr3+7J(}@c!PbC}Tg4y>HL`)Da)vx99ePkKux8;C3c#W7cUaWW^nO4ei9^a~WuhgEvpo13W5OR6b)qL`2E#7G&|kfR$qbg#w0= zElVs(bC!L^d}JajnJviTV@gT{JDUs>ZDC~NLh#*LXW#*A;UeAMmW zfpHnCa2zhaK`HLfM!DHI(zs;#cSkNCWnGU8>HkKk@KxeF^C8&4aoBp5z;>Q!e~&|P zt{o=;0@XXF-h0WezX>tjKErx9R%;Rp~*ioF#sLmi3;9;!f*77iDi2i $@ - -lib: $(LIBRARY) - -$(LIBRARY): $(COREOBJ) Makefile - $(AR) rcs $@ $(COREOBJ) - $(OBJDUMP) --syms $@ > $(LIBRARY:.a=.lst) - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.c -o $@ - -size: ${TARGET_ELF} - @echo - @${SIZE} -C --mcu=${MCU} ${TARGET_ELF} - -## Clean target -.PHONY: clean -clean: - touch Makefile - -rm -rf $(OBJECTS) $(TARGET_ELF) dep/* - -rm -rf $(LIBRARY) $(COREOBJ) $(LIBRARY:.a=.lst) - -rm -rf $(TARGET).hex $(TARGET).eep $(TARGET).lst $(TARGET).map - -## Other dependencies --include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) diff --git a/ports/pic18f6720/ai.c b/ports/pic18f6720/ai.c deleted file mode 100644 index 966f04ab..00000000 --- a/ports/pic18f6720/ai.c +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Analog Input Objects customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/ai.h" - -/* Analog Input = Photocell */ -#define MAX_ANALOG_INPUTS 2 - -static uint8_t Present_Value[MAX_ANALOG_INPUTS]; - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need validate that the */ -/* given instance exists */ -bool Analog_Input_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_ANALOG_INPUTS) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Analog_Input_Count(void) -{ - return MAX_ANALOG_INPUTS; -} - -/* we simply have 0-n object instances. */ -uint32_t Analog_Input_Index_To_Instance(unsigned index) -{ - return index; -} - -char *Analog_Input_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_ANALOG_INPUTS) { - snprintf(text, sizeof(text), "AI-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -float Analog_Input_Present_Value(uint32_t object_instance) -{ - float value = 0.0; - - if (object_instance < MAX_ANALOG_INPUTS) - value = Present_Value[object_instance]; - - return value; -} - -void Analog_Input_Present_Value_Set(uint32_t object_instance, float value) -{ - if (object_instance < MAX_ANALOG_INPUTS) { - Present_Value[object_instance] = value; - } -} - -/* return apdu length, or -1 on error */ -/* assumption - object has already exists */ -int Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - uint8_t *apdu = NULL; - - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_ANALOG_INPUT, rpdata->object_instance); - break; - /* note: Name and Description don't have to be the same. - You could make Description writable and different */ - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Analog_Input_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT); - break; - case PROP_PRESENT_VALUE: - apdu_len = encode_application_real( - &apdu[0], Analog_Input_Present_Value(rpdata->object_instance)); - break; - case PROP_STATUS_FLAGS: - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_UNITS: - apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} diff --git a/ports/pic18f6720/apdu.c b/ports/pic18f6720/apdu.c deleted file mode 100644 index 89666d27..00000000 --- a/ports/pic18f6720/apdu.c +++ /dev/null @@ -1,206 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include -#include -#include -/* BACnet Stack defines - first */ -#include "bacnet/bacdef.h" -/* BACnet Stack API */ -#include "bacnet/bacdcode.h" -#include "bacnet/dcc.h" -#include "bacnet/basic/services.h" -/* me */ -#include "bacnet/apdu.h" - -uint16_t apdu_timeout(void) -{ - return 3000; -} - -uint8_t apdu_retries(void) -{ - return 3; -} - -bool apdu_service_supported(BACNET_SERVICES_SUPPORTED service_supported) -{ - bool status = false; - - switch (service_supported) { - case SERVICE_SUPPORTED_READ_PROPERTY: - case SERVICE_SUPPORTED_WHO_IS: - case SERVICE_CONFIRMED_REINITIALIZE_DEVICE: - case SERVICE_SUPPORTED_WRITE_PROPERTY: - case SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL: - status = true; - break; - default: - break; - } - - return status; -} - -uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */ - uint16_t apdu_len, - BACNET_CONFIRMED_SERVICE_DATA *service_data, - uint8_t *service_choice, - uint8_t **service_request, - uint16_t *service_request_len) -{ - uint16_t len = 0; /* counts where we are in PDU */ - - service_data->segmented_message = (apdu[0] & BIT(3)) ? true : false; - service_data->more_follows = (apdu[0] & BIT(2)) ? true : false; - service_data->segmented_response_accepted = - (apdu[0] & BIT(1)) ? true : false; - service_data->max_segs = decode_max_segs(apdu[1]); - service_data->max_resp = decode_max_apdu(apdu[1]); - service_data->invoke_id = apdu[2]; - len = 3; - if (service_data->segmented_message) { - service_data->sequence_number = apdu[len++]; - service_data->proposed_window_number = apdu[len++]; - } - *service_choice = apdu[len++]; - *service_request = &apdu[len]; - *service_request_len = apdu_len - len; - - return len; -} - -/* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice APDUs - shall be processed and no messages shall be initiated. - When the initiation of communications is disabled, - all APDUs shall be processed and responses returned as - required... */ -static bool apdu_confirmed_dcc_disabled(uint8_t service_choice) -{ - bool status = false; - - if (dcc_communication_disabled()) { - switch (service_choice) { - case SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL: - case SERVICE_CONFIRMED_REINITIALIZE_DEVICE: - break; - default: - status = true; - break; - } - } - - return status; -} - -/* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice APDUs - shall be processed and no messages shall be initiated. */ -/* If the request is valid and the 'Enable/Disable' parameter is - DISABLE_INITIATION, the responding BACnet-user shall - discontinue the initiation of messages except for I-Am - requests issued in accordance with the Who-Is service procedure.*/ -static bool apdu_unconfirmed_dcc_disabled(uint8_t service_choice) -{ - bool status = false; - - if (dcc_communication_disabled()) { - /* there are no Unconfirmed messages that - can be processed in this state */ - status = true; - } else if (dcc_communication_initiation_disabled()) { - /* WhoIs will be processed and I-Am initiated as response. */ - switch (service_choice) { - case SERVICE_UNCONFIRMED_WHO_IS: - case SERVICE_UNCONFIRMED_WHO_HAS: - break; - default: - status = true; - break; - } - } - - return status; -} - -void apdu_handler(BACNET_ADDRESS *src, - uint8_t *apdu, /* APDU data */ - uint16_t apdu_len) -{ - BACNET_CONFIRMED_SERVICE_DATA service_data = { 0 }; - uint8_t service_choice = 0; - uint8_t *service_request = NULL; - uint16_t service_request_len = 0; - uint16_t len = 0; /* counts where we are in PDU */ - - if (apdu) { - /* PDU Type */ - switch (apdu[0] & 0xF0) { - case PDU_TYPE_CONFIRMED_SERVICE_REQUEST: - len = apdu_decode_confirmed_service_request( - &apdu[0], /* APDU data */ - apdu_len, &service_data, &service_choice, &service_request, - &service_request_len); - if (len == 0) { - /* service data unable to be decoded - simply drop */ - break; - } - if (apdu_confirmed_dcc_disabled(service_choice)) { - /* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice - APDUs shall be processed and no messages shall be - initiated. */ - break; - } - if (service_choice == SERVICE_CONFIRMED_READ_PROPERTY) { - handler_read_property(service_request, service_request_len, - src, &service_data); - } else if (service_choice == SERVICE_CONFIRMED_WRITE_PROPERTY) { - handler_write_property(service_request, service_request_len, - src, &service_data); - } else if (service_choice == - SERVICE_CONFIRMED_REINITIALIZE_DEVICE) { - handler_reinitialize_device(service_request, - service_request_len, src, &service_data); - } else if (service_choice == - SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL) { - handler_device_communication_control(service_request, - service_request_len, src, &service_data); - } else { - handler_unrecognized_service(service_request, - service_request_len, src, &service_data); - } - break; - case PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST: - service_choice = apdu[1]; - service_request = &apdu[2]; - service_request_len = apdu_len - 2; - if (apdu_unconfirmed_dcc_disabled(service_choice)) { - /* When network communications are disabled, - only DeviceCommunicationControl and ReinitializeDevice - APDUs shall be processed and no messages shall be - initiated. If communications have been initiation - disabled, then WhoIs may be processed. */ - break; - } - if (service_choice == SERVICE_UNCONFIRMED_WHO_IS) { - handler_who_is(service_request, service_request_len, src); - } - break; - case PDU_TYPE_SIMPLE_ACK: - case PDU_TYPE_COMPLEX_ACK: - case PDU_TYPE_SEGMENT_ACK: - case PDU_TYPE_ERROR: - case PDU_TYPE_REJECT: - case PDU_TYPE_ABORT: - default: - break; - } - } - return; -} diff --git a/ports/pic18f6720/av.c b/ports/pic18f6720/av.c deleted file mode 100644 index 316240fe..00000000 --- a/ports/pic18f6720/av.c +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Analog Value Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/bacapp.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/av.h" - -#define MAX_ANALOG_VALUES 4 - -/* we choose to have a NULL level in our system represented by */ -/* a particular value. When the priorities are not in use, they */ -/* will be relinquished (i.e. set to the NULL level). */ -#define ANALOG_LEVEL_NULL 255 -/* When all the priorities are level null, the present value returns */ -/* the Relinquish Default value */ -#define ANALOG_RELINQUISH_DEFAULT 0 -/* Here is our Present_Value. They are supposed to be Real, but */ -/* we don't have that kind of memory, so we will use a single byte */ -/* and load a Real for returning the value when asked. */ -static uint8_t Present_Value[MAX_ANALOG_VALUES]; - -/* we need to have our arrays initialized before answering any calls */ -static bool Analog_Value_Initialized = false; - -void Analog_Value_Init(void) -{ - unsigned i; - - if (!Analog_Value_Initialized) { - Analog_Value_Initialized = true; - - /* initialize all the analog output priority arrays to NULL */ - for (i = 0; i < MAX_ANALOG_VALUES; i++) { - Present_Value[i] = ANALOG_LEVEL_NULL; - } - } - - return; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need validate that the */ -/* given instance exists */ -bool Analog_Value_Valid_Instance(uint32_t object_instance) -{ - Analog_Value_Init(); - if (object_instance < MAX_ANALOG_VALUES) - return true; - - return false; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then count how many you have */ -unsigned Analog_Value_Count(void) -{ - Analog_Value_Init(); - return MAX_ANALOG_VALUES; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the instance */ -/* that correlates to the correct index */ -uint32_t Analog_Value_Index_To_Instance(unsigned index) -{ - Analog_Value_Init(); - return index; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the index */ -/* that correlates to the correct instance number */ -unsigned Analog_Value_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_ANALOG_VALUES; - - Analog_Value_Init(); - if (object_instance < MAX_ANALOG_VALUES) - index = object_instance; - - return index; -} - -float Analog_Value_Present_Value(uint32_t object_instance) -{ - float value = ANALOG_RELINQUISH_DEFAULT; - unsigned index = 0; - unsigned i = 0; - - Analog_Value_Init(); - index = Analog_Value_Instance_To_Index(object_instance); - if (index < MAX_ANALOG_VALUES) { - value = Present_Value[index]; - } - - return value; -} - -/* note: the object name must be unique within this device */ -char *Analog_Value_Name(uint32_t object_instance) -{ - static char text[32] = ""; /* okay for single thread */ - - if (object_instance < MAX_ANALOG_VALUES) { - snprintf(text, sizeof(text), "AV-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int len = 0; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - float real_value = (float)1.414; - unsigned object_index = 0; - unsigned i = 0; - bool state = false; - uint8_t *apdu = NULL; - - Analog_Value_Init(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_ANALOG_VALUE, rpdata->object_instance); - break; - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Analog_Value_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE); - break; - case PROP_PRESENT_VALUE: - real_value = Analog_Value_Present_Value(rpdata->object_instance); - apdu_len = encode_application_real(&apdu[0], real_value); - break; - case PROP_STATUS_FLAGS: - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: -#if 0 - object_index = Analog_Value_Instance_To_Index(object_instance); - state = Analog_Value_Out_Of_Service[object_index]; -#endif - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_UNITS: - apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT); - break; -#if 0 - case PROP_PRIORITY_ARRAY: - /* Array element zero is the number of elements in the array */ - if (array_index == 0) - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY); - /* if no index was specified, then try to encode the entire list */ - /* into one packet. */ - else if (array_index == BACNET_ARRAY_ALL) { - object_index = Analog_Value_Instance_To_Index(object_instance); - for (i = 0; i < BACNET_MAX_PRIORITY; i++) { - /* FIXME: check if we have room before adding it to APDU */ - if (Present_Value[object_index][i] == ANALOG_LEVEL_NULL) - len = encode_application_null(&apdu[apdu_len]); - else { - real_value = Present_Value[object_index][i]; - len = - encode_application_real(&apdu[apdu_len], - real_value); - } - /* add it if we have room */ - if ((apdu_len + len) < MAX_APDU) - apdu_len += len; - else { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - apdu_len = BACNET_STATUS_ABORT; - break; - } - } - } else { - object_index = Analog_Value_Instance_To_Index(object_instance); - if (array_index <= BACNET_MAX_PRIORITY) { - if (Present_Value[object_index][array_index - 1] == - ANALOG_LEVEL_NULL) - apdu_len = encode_application_null(&apdu[0]); - else { - real_value = - Present_Value[object_index][array_index - 1]; - apdu_len = - encode_application_real(&apdu[0], real_value); - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - apdu_len = BACNET_STATUS_ERROR; - } - } - - break; - case PROP_RELINQUISH_DEFAULT: - real_value = ANALOG_RELINQUISH_DEFAULT; - apdu_len = encode_application_real(&apdu[0], real_value); - break; -#endif - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = BACNET_STATUS_ERROR; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && -#if 0 - (property != PROP_PRIORITY_ARRAY) && -#endif - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - unsigned int priority = 0; - uint8_t level = ANALOG_LEVEL_NULL; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - Analog_Value_Init(); - if (!Analog_Value_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_PRIORITY_ARRAY) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_REAL) { - priority = wp_data->priority; - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - if (priority && (priority <= BACNET_MAX_PRIORITY) && - (priority != 6 /* reserved */) && - (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { - level = (uint8_t)value.type.Real; - object_index = Analog_Value_Instance_To_Index( - wp_data->object_instance); - priority--; - Present_Value[object_index] = level; - /* Note: you could set the physical output here if we - are the highest priority. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing - output) */ - status = true; - } else if (priority == 6) { - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#if 0 - } else if (value.tag == BACNET_APPLICATION_TAG_NULL) { - level = ANALOG_LEVEL_NULL; - object_index = - Analog_Value_Instance_To_Index(wp_data->object_instance); - priority = wp_data->priority; - if (priority && (priority <= BACNET_MAX_PRIORITY)) { - priority--; - Present_Value[object_index][priority] = level; - /* Note: you could set the physical output here to the next - highest priority, or to the relinquish default if no - priorities are set. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing output) */ - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#endif - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#if 0 - case PROP_OUT_OF_SERVICE: - if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) { - object_index = - Analog_Value_Instance_To_Index(wp_data->object_instance); - Analog_Value_Out_Of_Service[object_index] = value.type.Boolean; - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#endif - case PROP_OBJECT_IDENTIFIER: - case PROP_OBJECT_NAME: - case PROP_OBJECT_TYPE: - case PROP_STATUS_FLAGS: - case PROP_EVENT_STATE: - case PROP_OUT_OF_SERVICE: - case PROP_DESCRIPTION: - case PROP_PRIORITY_ARRAY: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} diff --git a/ports/pic18f6720/bi.c b/ports/pic18f6720/bi.c deleted file mode 100644 index f5937bd6..00000000 --- a/ports/pic18f6720/bi.c +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Input Objects customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/bi.h" - -#define MAX_BINARY_INPUTS 8 - -static BACNET_BINARY_PV Present_Value[MAX_BINARY_INPUTS]; - -static void Binary_Input_Initialize(void) -{ - static bool initialized = false; - unsigned i; - - if (!initialized) { - initialized = true; - for (i = 0; i < MAX_BINARY_INPUTS; i++) { - Present_Value[i] = BINARY_INACTIVE; - } - } -} - -/* we simply have 0-n object instances. */ -bool Binary_Input_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_INPUTS) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Input_Count(void) -{ - return MAX_BINARY_INPUTS; -} - -/* we simply have 0-n object instances.*/ -uint32_t Binary_Input_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the index */ -/* that correlates to the correct instance number */ -unsigned Binary_Input_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_INPUTS; - - if (object_instance < MAX_BINARY_INPUTS) - index = object_instance; - - return index; -} - -BACNET_BINARY_PV Binary_Input_Present_Value(uint32_t object_instance) -{ - BACNET_BINARY_PV value = BINARY_INACTIVE; - unsigned index = 0; - - Binary_Input_Initialize(); - index = Binary_Input_Instance_To_Index(object_instance); - if (index < MAX_BINARY_INPUTS) { - value = Present_Value[index]; - } - - return value; -} - -char *Binary_Input_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_BINARY_INPUTS) { - snprintf(text, sizeof(text), "BI-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu length, or -1 on error */ -/* assumption - object already exists, and has been bounds checked */ -int Binary_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_POLARITY polarity = POLARITY_NORMAL; - BACNET_BINARY_PV value = BINARY_INACTIVE; - uint8_t *apdu = NULL; - - Binary_Input_Initialize(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_BINARY_INPUT, rpdata->object_instance); - break; - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - /* note: object name must be unique in our device */ - characterstring_init_ansi( - &char_string, Binary_Input_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_BINARY_INPUT); - break; - case PROP_PRESENT_VALUE: - value = Binary_Input_Present_Value(rpdata->object_instance); - apdu_len = encode_application_enumerated(&apdu[0], value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_POLARITY: - apdu_len = encode_application_enumerated(&apdu[0], polarity); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} diff --git a/ports/pic18f6720/bv.c b/ports/pic18f6720/bv.c deleted file mode 100644 index 0b319e83..00000000 --- a/ports/pic18f6720/bv.c +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Value Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/bv.h" - -#define MAX_BINARY_VALUES 8 - -static BACNET_BINARY_PV Present_Value[MAX_BINARY_VALUES]; - -static void Binary_Value_Initialize(void) -{ - static bool initialized = false; - unsigned i; - - if (!initialized) { - initialized = true; - for (i = 0; i < MAX_BINARY_VALUES; i++) { - Present_Value[i] = BINARY_INACTIVE; - } - } -} - -/* we simply have 0-n object instances. */ -bool Binary_Value_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_VALUES) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Count(void) -{ - return MAX_BINARY_VALUES; -} - -/* we simply have 0-n object instances. */ -uint32_t Binary_Value_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_VALUES; - - if (object_instance < MAX_BINARY_VALUES) - index = object_instance; - - return index; -} - -BACNET_BINARY_PV Binary_Value_Present_Value(uint32_t object_instance) -{ - BACNET_BINARY_PV value = BINARY_INACTIVE; - - Binary_Value_Initialize(); - if (object_instance < MAX_BINARY_VALUES) { - value = Present_Value[object_instance]; - } - - return value; -} - -/* note: the object name must be unique within this device */ -char *Binary_Value_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_BINARY_VALUES) { - snprintf(text, sizeof(text), "BV-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int len = 0; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_BINARY_PV present_value = BINARY_INACTIVE; - BACNET_POLARITY polarity = POLARITY_NORMAL; - unsigned object_index = 0; - unsigned i = 0; - bool state = false; - uint8_t *apdu = NULL; - - Binary_Value_Initialize(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_BINARY_VALUE, rpdata->object_instance); - break; - /* note: Name and Description don't have to be the same. - You could make Description writable and different */ - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Binary_Value_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE); - break; - case PROP_PRESENT_VALUE: - present_value = Binary_Value_Present_Value(rpdata->object_instance); - apdu_len = encode_application_enumerated(&apdu[0], present_value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_POLARITY: - /* FIXME: figure out the polarity */ - apdu_len = encode_application_enumerated(&apdu[0], polarity); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - unsigned int priority = 0; - BACNET_BINARY_PV level = BINARY_NULL; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Binary_Value_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_PRIORITY_ARRAY) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) { - priority = wp_data->priority; - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - if (priority && (priority <= BACNET_MAX_PRIORITY) && - (priority != 6 /* reserved */) && - (value.type.Enumerated >= MIN_BINARY_PV) && - (value.type.Enumerated <= MAX_BINARY_PV)) { - level = value.type.Enumerated; - object_index = Binary_Value_Instance_To_Index( - wp_data->object_instance); - priority--; - /* NOTE: this Binary value has no priority array */ - Present_Value[object_index] = level; - /* Note: you could set the physical output here if we - are the highest priority. - However, if Out of Service is TRUE, then don't set the - physical output. */ - status = true; - } else if (priority == 6) { - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else if (value.tag == BACNET_APPLICATION_TAG_NULL) { -#if 0 - /* NOTE: this Binary Value has no priority array */ - level = BINARY_NULL; - object_index = - Binary_Value_Instance_To_Index(wp_data->object_instance); - priority = wp_data->priority; - if (priority && (priority <= BACNET_MAX_PRIORITY)) { - priority--; - Binary_Value_Level[object_index][priority] = level; - /* Note: you could set the physical output here to the next - highest priority, or to the relinquish default if no - priorities are set. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing output) */ - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#else - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; -#endif - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_OUT_OF_SERVICE: -#if 0 - if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) { - object_index = - Binary_Value_Instance_To_Index(wp_data->object_instance); - Binary_Value_Out_Of_Service[object_index] = value.type.Boolean; - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#endif - case PROP_OBJECT_IDENTIFIER: - case PROP_OBJECT_NAME: - case PROP_OBJECT_TYPE: - case PROP_STATUS_FLAGS: - case PROP_EVENT_STATE: - case PROP_POLARITY: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} diff --git a/ports/pic18f6720/device.c b/ports/pic18f6720/device.c deleted file mode 100644 index ed057eba..00000000 --- a/ports/pic18f6720/device.c +++ /dev/null @@ -1,775 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include /* for memmove */ -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacstr.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/apdu.h" -#include "bacnet/datalink/dlmstp.h" -#include "rs485.h" -#include "bacnet/basic/object/ai.h" -#include "bacnet/basic/object/av.h" -#include "bacnet/basic/object/bi.h" -#include "bacnet/basic/object/bv.h" -#include "bacnet/rp.h" -#include "bacnet/wp.h" -#include "bacnet/dcc.h" -#include "bacnet/version.h" -#include "bacnet/basic/object/device.h" /* me */ - -/* note: you really only need to define variables for - properties that are writable or that may change. - The properties that are constant can be hard coded - into the read-property encoding. */ -static uint32_t Object_Instance_Number = 12345; -static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL; -static uint8_t Database_Revision; -BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE; -static const char *Reinit_Password = "filister"; - -/** - * @brief Sets the ReinitializeDevice password - * - * The password shall be a null terminated C string of up to - * 20 ASCII characters for those devices that require the password. - * - * For those devices that do not require a password, set to NULL or - * point to a zero length C string (null terminated). - * - * @param the ReinitializeDevice password; can be NULL or empty string - */ -bool Device_Reinitialize_Password_Set(const char *password) -{ - Reinit_Password = password; - - return true; -} - -/** Commands a Device re-initialization, to a given state. - * The request's password must match for the operation to succeed. - * This implementation provides a framework, but doesn't - * actually *DO* anything. - * @note You could use a mix of states and passwords to multiple outcomes. - * @note You probably want to restart *after* the simple ack has been sent - * from the return handler, so just set a local flag here. - * @ingroup ObjIntf - * - * @param rd_data [in,out] The information from the RD request. - * On failure, the error class and code will be set. - * @return True if succeeds (password is correct), else False. - */ -bool Device_Reinitialize(BACNET_REINITIALIZE_DEVICE_DATA *rd_data) -{ - bool status = false; - bool password_success = false; - - /* From 16.4.1.1.2 Password - This optional parameter shall be a CharacterString of up to - 20 characters. For those devices that require the password as a - protection, the service request shall be denied if the parameter - is absent or if the password is incorrect. For those devices that - do not require a password, this parameter shall be ignored.*/ - if (Reinit_Password && strlen(Reinit_Password) > 0) { - if (characterstring_length(&rd_data->password) > 20) { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE; - } else if (characterstring_ansi_same( - &rd_data->password, Reinit_Password)) { - password_success = true; - } else { - rd_data->error_class = ERROR_CLASS_SECURITY; - rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE; - } - } else { - password_success = true; - } - if (password_success) { - switch (rd_data->state) { - case BACNET_REINIT_COLDSTART: - case BACNET_REINIT_WARMSTART: - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); - /* note: you probably want to restart *after* the - simple ack has been sent from the return handler - so just set a flag from here */ - Reinitialize_State = rd_data->state; - status = true; - break; - case BACNET_REINIT_STARTBACKUP: - case BACNET_REINIT_ENDBACKUP: - case BACNET_REINIT_STARTRESTORE: - case BACNET_REINIT_ENDRESTORE: - case BACNET_REINIT_ABORTRESTORE: - if (dcc_communication_disabled()) { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED; - } else { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = - ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED; - } - break; - default: - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE; - break; - } - } - - return status; -} - -BACNET_REINITIALIZED_STATE Device_Reinitialized_State(void) -{ - return Reinitialize_State; -} - -void Device_Init(object_functions_t *object_table) -{ - (void)object_table; - Reinitialize_State = BACNET_REINIT_IDLE; - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); - /* FIXME: Get the data from the eeprom */ - /* I2C_Read_Block(EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ -} - -/* methods to manipulate the data */ -uint32_t Device_Object_Instance_Number(void) -{ - return Object_Instance_Number; -} - -bool Device_Set_Object_Instance_Number(uint32_t object_id) -{ - bool status = true; /* return value */ - - if (object_id <= BACNET_MAX_INSTANCE) { - Object_Instance_Number = object_id; - Database_Revision++; - /* FIXME: Write the data to the eeprom */ - /* I2C_Write_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ - } else - status = false; - - return status; -} - -bool Device_Valid_Object_Instance_Number(uint32_t object_id) -{ - /* BACnet allows for a wildcard instance number */ - return (Object_Instance_Number == object_id); -} - -BACNET_DEVICE_STATUS Device_System_Status(void) -{ - return System_Status; -} - -int Device_Set_System_Status(BACNET_DEVICE_STATUS status, bool local) -{ - if (status < MAX_DEVICE_STATUS) { - System_Status = status; - } -} - -uint16_t Device_Vendor_Identifier(void) -{ - return BACNET_VENDOR_ID; -} - -uint8_t Device_Protocol_Version(void) -{ - return BACNET_PROTOCOL_VERSION; -} - -uint8_t Device_Protocol_Revision(void) -{ - return BACNET_PROTOCOL_REVISION; -} - -BACNET_SEGMENTATION Device_Segmentation_Supported(void) -{ - return SEGMENTATION_NONE; -} - -uint32_t Device_Database_Revision(void) -{ - return Database_Revision; -} - -/* Since many network clients depend on the object list */ -/* for discovery, it must be consistent! */ -unsigned Device_Object_List_Count(void) -{ - unsigned count = 1; /* at least 1 for device object */ - - /* FIXME: add objects as needed */ - count += Binary_Value_Count(); - count += Analog_Input_Count(); - count += Binary_Input_Count(); - count += Analog_Value_Count(); - - return count; -} - -/* Since many network clients depend on the object list */ -/* for discovery, it must be consistent! */ -bool Device_Object_List_Identifier( - uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance) -{ - bool status = false; - uint32_t object_index = 0; - uint32_t object_count = 0; - - /* device object */ - if (array_index == 1) { - *object_type = OBJECT_DEVICE; - *instance = Object_Instance_Number; - status = true; - } - /* normalize the index since - we know it is not the previous objects */ - /* array index starts at 1 */ - object_index = array_index - 1; - /* 1 for the device object */ - object_count = 1; - /* FIXME: add objects as needed */ - /* binary value objects */ - if (!status) { - object_index -= object_count; - object_count = Binary_Value_Count(); - /* is it a valid index for this object? */ - if (object_index < object_count) { - *object_type = OBJECT_BINARY_VALUE; - *instance = Binary_Value_Index_To_Instance(object_index); - status = true; - } - } - /* analog input objects */ - if (!status) { - /* array index starts at 1, and 1 for the device object */ - object_index -= object_count; - object_count = Analog_Value_Count(); - if (object_index < object_count) { - *object_type = OBJECT_ANALOG_VALUE; - *instance = Analog_Value_Index_To_Instance(object_index); - status = true; - } - } - /* analog input objects */ - if (!status) { - /* array index starts at 1, and 1 for the device object */ - object_index -= object_count; - object_count = Analog_Input_Count(); - if (object_index < object_count) { - *object_type = OBJECT_ANALOG_INPUT; - *instance = Analog_Input_Index_To_Instance(object_index); - status = true; - } - } - /* binary input objects */ - if (!status) { - /* normalize the index since - we know it is not the previous objects */ - object_index -= object_count; - object_count = Binary_Input_Count(); - /* is it a valid index for this object? */ - if (object_index < object_count) { - *object_type = OBJECT_BINARY_INPUT; - *instance = Binary_Input_Index_To_Instance(object_index); - status = true; - } - } - - return status; -} - -/** - * @brief Encode a BACnetARRAY property element - * @param object_instance [in] BACnet network port object instance number - * @param array_index [in] array index requested: - * 0 to N for individual array members - * @param apdu [out] Buffer in which the APDU contents are built, or NULL to - * return the length of buffer if it had been built - * @return The length of the apdu encoded or - * BACNET_STATUS_ERROR for ERROR_CODE_INVALID_ARRAY_INDEX - */ -int Device_Object_List_Element_Encode( - uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu) -{ - int apdu_len = BACNET_STATUS_ERROR; - BACNET_OBJECT_TYPE object_type; - uint32_t instance; - bool found; - - if (object_instance == Device_Object_Instance_Number()) { - /* single element is zero based, add 1 for BACnetARRAY which is one - * based */ - array_index++; - found = - Device_Object_List_Identifier(array_index, &object_type, &instance); - if (found) { - apdu_len = - encode_application_object_id(apdu, object_type, instance); - } - } - - return apdu_len; -} - -/* returns true if successful */ -int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata) -{ - static char string_buffer[28]; - static BACNET_CHARACTER_STRING char_string; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - uint32_t i = 0; - uint32_t count = 0; - BACNET_TIME local_time; - BACNET_DATE local_date; - uint8_t year = 0; - int16_t TimeZone = 0; - uint8_t *apdu = NULL; - int apdu_max = 0; - - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - /* FIXME: change the hardcoded names to suit your application */ - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_DEVICE, Object_Instance_Number); - break; - case PROP_OBJECT_NAME: - (void)strcpypgm2ram(&string_buffer[0], "PIC18F6720 Device"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = encode_application_enumerated(&apdu[0], OBJECT_DEVICE); - break; - case PROP_DESCRIPTION: - (void)strcpypgm2ram(&string_buffer[0], "BACnet Demo"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_SYSTEM_STATUS: - apdu_len = - encode_application_enumerated(&apdu[0], Device_System_Status()); - break; - case PROP_VENDOR_NAME: - (void)strcpypgm2ram(&string_buffer[0], BACNET_VENDOR_NAME); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_VENDOR_IDENTIFIER: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Vendor_Identifier()); - break; - case PROP_MODEL_NAME: - (void)strcpypgm2ram(&string_buffer[0], "GNU Demo"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_FIRMWARE_REVISION: - (void)strcpypgm2ram(&string_buffer[0], BACNET_VERSION_TEXT); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_APPLICATION_SOFTWARE_VERSION: - (void)strcpypgm2ram(&string_buffer[0], "1.0"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_LOCATION: - (void)strcpypgm2ram(&string_buffer[0], "USA"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_PROTOCOL_VERSION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Protocol_Version()); - break; - case PROP_PROTOCOL_REVISION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Protocol_Revision()); - break; - case PROP_PROTOCOL_SERVICES_SUPPORTED: - /* Note: list of services that are executed, not initiated. */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { - /* automatic lookup based on handlers set */ - bitstring_set_bit( - &bit_string, (uint8_t)i, apdu_service_supported(i)); - } - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - /* Note: this is the list of objects that can be in this device, - not a list of objects that this device can access */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_ASHRAE_OBJECT_TYPE; i++) { - /* initialize all the object types to not-supported */ - bitstring_set_bit(&bit_string, (uint8_t)i, false); - } - /* FIXME: indicate the objects that YOU support */ - bitstring_set_bit(&bit_string, OBJECT_DEVICE, true); - bitstring_set_bit(&bit_string, OBJECT_ANALOG_VALUE, true); - bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true); - bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true); - bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_OBJECT_LIST: - count = Device_Object_List_Count(); - apdu_len = bacnet_array_encode(rpdata->object_instance, - rpdata->array_index, - Device_Object_List_Element_Encode, - count, apdu, apdu_max); - if (apdu_len == BACNET_STATUS_ABORT) { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - } else if (apdu_len == BACNET_STATUS_ERROR) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - } - break; - case PROP_MAX_APDU_LENGTH_ACCEPTED: - apdu_len = encode_application_unsigned(&apdu[0], MAX_APDU); - break; - case PROP_SEGMENTATION_SUPPORTED: - apdu_len = encode_application_enumerated( - &apdu[0], Device_Segmentation_Supported()); - break; - case PROP_APDU_TIMEOUT: - apdu_len = encode_application_unsigned(&apdu[0], apdu_timeout()); - break; - case PROP_NUMBER_OF_APDU_RETRIES: - apdu_len = encode_application_unsigned(&apdu[0], apdu_retries()); - break; - case PROP_DEVICE_ADDRESS_BINDING: - /* FIXME: encode the list here, if it exists */ - break; - case PROP_DATABASE_REVISION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Database_Revision()); - break; - case PROP_MAX_INFO_FRAMES: - apdu_len = - encode_application_unsigned(&apdu[0], dlmstp_max_info_frames()); - break; - case PROP_MAX_MASTER: - apdu_len = - encode_application_unsigned(&apdu[0], dlmstp_max_master()); - break; - case PROP_LOCAL_TIME: - /* FIXME: if you support time */ - local_time.hour = 0; - local_time.min = 0; - local_time.sec = 0; - local_time.hundredths = 0; - apdu_len = encode_application_time(&apdu[0], &local_time); - break; - case PROP_UTC_OFFSET: - /* Note: BACnet Time Zone is offset of local time and UTC, - rather than offset of GMT. It is expressed in minutes */ - apdu_len = encode_application_signed(&apdu[0], 5 * 60 /* EST */); - break; - case PROP_LOCAL_DATE: - /* FIXME: if you support date */ - local_date.year = 2006; /* AD */ - local_date.month = 4; /* Jan=1..Dec=12 */ - local_date.day = 11; /* 1..31 */ - local_date.wday = 0; /* 1=Mon..7=Sun */ - apdu_len = encode_application_date(&apdu[0], &local_date); - break; - case PROP_DAYLIGHT_SAVINGS_STATUS: - /* FIXME: if you support time/date */ - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case 9600: - apdu_len = - encode_application_unsigned(&apdu[0], RS485_Get_Baud_Rate()); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->object_property != PROP_OBJECT_LIST) && - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = BACNET_STATUS_ERROR; - - /* initialize the default return values */ - rpdata->error_class = ERROR_CLASS_OBJECT; - rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT; - switch (rpdata->object_type) { - case OBJECT_ANALOG_INPUT: - if (Analog_Input_Valid_Instance(rpdata->object_instance)) { - apdu_len = Analog_Input_Read_Property(rpdata); - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Valid_Instance(rpdata->object_instance)) { - apdu_len = Analog_Value_Read_Property(rpdata); - } - break; - case OBJECT_BINARY_INPUT: - if (Binary_Input_Valid_Instance(rpdata->object_instance)) { - apdu_len = Binary_Input_Read_Property(rpdata); - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Valid_Instance(rpdata->object_instance)) { - apdu_len = Binary_Value_Read_Property(rpdata); - } - break; - case OBJECT_DEVICE: - if (Device_Valid_Object_Instance_Number(rpdata->object_instance)) { - apdu_len = Device_Read_Property_Local(rpdata); - } - break; - default: - break; - } - - return apdu_len; -} - -bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Device_Valid_Object_Instance_Number(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_OBJECT_LIST) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_OBJECT_IDENTIFIER: - if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { - if ((value.type.Object_Id.type == OBJECT_DEVICE) && - (Device_Set_Object_Instance_Number( - value.type.Object_Id.instance))) { - /* we could send an I-Am broadcast to let the world know */ - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_MAX_INFO_FRAMES: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if (value.type.Unsigned_Int <= 255) { - dlmstp_set_max_info_frames(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_MAX_MASTER: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if ((value.type.Unsigned_Int > 0) && - (value.type.Unsigned_Int <= 127)) { - dlmstp_set_max_master(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_OBJECT_NAME: - if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) { - uint8_t encoding; - size_t len; - - encoding = - characterstring_encoding(&value.type.Character_String); - len = characterstring_length(&value.type.Character_String); - if (encoding == CHARACTER_ANSI_X34) { - if (len <= 20) { - /* FIXME: set the name */ - /* Display_Set_Name( - characterstring_value(&value.type.Character_String)); - */ - /* FIXME: All the object names in a device must be - unique. Disallow setting the Device Object Name to - any objects in the device. */ - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = - ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = - ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case 9600: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if (value.type.Unsigned_Int > 115200) { - RS485_Set_Baud_Rate(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_NUMBER_OF_APDU_RETRIES: - case PROP_APDU_TIMEOUT: - case PROP_VENDOR_IDENTIFIER: - case PROP_SYSTEM_STATUS: - case PROP_LOCATION: - case PROP_DESCRIPTION: - case PROP_MODEL_NAME: - case PROP_VENDOR_NAME: - case PROP_FIRMWARE_REVISION: - case PROP_APPLICATION_SOFTWARE_VERSION: - case PROP_LOCAL_TIME: - case PROP_UTC_OFFSET: - case PROP_LOCAL_DATE: - case PROP_DAYLIGHT_SAVINGS_STATUS: - case PROP_PROTOCOL_VERSION: - case PROP_PROTOCOL_REVISION: - case PROP_PROTOCOL_SERVICES_SUPPORTED: - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - case PROP_OBJECT_LIST: - case PROP_MAX_APDU_LENGTH_ACCEPTED: - case PROP_SEGMENTATION_SUPPORTED: - case PROP_DEVICE_ADDRESS_BINDING: - case PROP_DATABASE_REVISION: - case PROP_ACTIVE_COV_SUBSCRIPTIONS: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} - -bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* Ever the pessamist! */ - struct object_functions *pObject = NULL; - - /* initialize the default return values */ - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - switch (wp_data->object_type) { - case OBJECT_ANALOG_INPUT: - if (Analog_Input_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Valid_Instance(wp_data->object_instance)) { - status = Analog_Value_Write_Property(wp_data); - } - break; - case OBJECT_BINARY_INPUT: - if (Binary_Input_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Valid_Instance(wp_data->object_instance)) { - status = Binary_Value_Write_Property(wp_data); - } - break; - case OBJECT_DEVICE: - if (Device_Valid_Object_Instance_Number(wp_data->object_instance)) { - status = Device_Write_Property_Local(wp_data); - } - break; - default: - break; - } - - return (status); -} diff --git a/ports/pic18f6720/dlmstp.c b/ports/pic18f6720/dlmstp.c deleted file mode 100644 index 7e677ab3..00000000 --- a/ports/pic18f6720/dlmstp.c +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -#include -#include -#if PRINT_ENABLED -#include -#endif -#include "bacnet/bacdef.h" -#include "bacnet/datalink/mstp.h" -#include "bacnet/datalink/dlmstp.h" -#include "rs485.h" -#include "bacnet/npdu.h" -#include "bacnet/basic/services.h" - -/* Number of MS/TP Packets Rx/Tx */ -uint16_t MSTP_Packets = 0; - -/* receive buffer */ -#pragma udata MSTP_RxData -static DLMSTP_PACKET Receive_Buffer; -/* temp buffer for NPDU insertion */ -/* local MS/TP port data - shared with RS-485 */ -#pragma udata MSTP_PortData -volatile struct mstp_port_struct_t MSTP_Port; -#pragma udata - -#define INCREMENT_AND_LIMIT_UINT16(x) \ - { \ - if (x < 0xFFFF) \ - x++; \ - } - -void dlmstp_millisecond_timer(void) -{ - INCREMENT_AND_LIMIT_UINT16(MSTP_Port.SilenceTimer); -} - -void dlmstp_reinit(void) -{ - RS485_Reinit(); - dlmstp_set_my_address(DEFAULT_MAC_ADDRESS); - dlmstp_set_max_info_frames(DEFAULT_MAX_INFO_FRAMES); - dlmstp_set_max_master(DEFAULT_MAX_MASTER); -} - -void dlmstp_init(void) -{ - uint8_t data; - - /* initialize buffer */ - Receive_Buffer.ready = false; - Receive_Buffer.pdu_len = 0; - /* initialize hardware */ - RS485_Initialize(); - MSTP_Port.InputBuffer = &Receive_Buffer.pdu[0]; - MSTP_Init(&MSTP_Port); -} - -void dlmstp_cleanup(void) -{ - /* nothing to do for static buffers */ -} - -/* returns number of bytes sent on success, zero on failure */ -int dlmstp_send_pdu(BACNET_ADDRESS *dest, /* destination address */ - BACNET_NPDU_DATA *npdu_data, /* network information */ - uint8_t *pdu, /* any data to be sent - may be null */ - unsigned pdu_len) -{ /* number of bytes of data */ - int bytes_sent = 0; - unsigned npdu_len = 0; - uint8_t frame_type = 0; - BACNET_ADDRESS src; - unsigned i = 0; /* loop counter */ - - if (MSTP_Port.TxReady == false) { - if (npdu_data->data_expecting_reply) - MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY; - else - MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY; - - /* load destination MAC address */ - if (dest && dest->mac_len) { - MSTP_Port.TxDestination = dest->mac[0]; - } else { - /* mac_len = 0 is a broadcast address */ - MSTP_Port.TxDestination = MSTP_BROADCAST_ADDRESS; - } - dlmstp_get_my_address(&src); - if ((DLMSTP_HEADER_MAX + pdu_len) > DLMSTP_MPDU_MAX) { - return -4; - } - bytes_sent = MSTP_Create_Frame((uint8_t *)&MSTP_Port.TxBuffer[0], - sizeof(MSTP_Port.TxBuffer), MSTP_Port.TxFrameType, - MSTP_Port.TxDestination, MSTP_Port.This_Station, pdu, pdu_len); - MSTP_Port.TxLength = bytes_sent; - MSTP_Port.TxReady = true; - MSTP_Packets++; - } - - return bytes_sent; -} - -void dlmstp_task(void) -{ - bool bytes_remaining; - bool received_frame; - - /* only do receive state machine while we don't have a frame */ - if ((MSTP_Port.ReceivedValidFrame == false) && - (MSTP_Port.ReceivedInvalidFrame == false)) { - do { - bytes_remaining = RS485_Check_UART_Data(&MSTP_Port); - MSTP_Receive_Frame_FSM(&MSTP_Port); - received_frame = - MSTP_Port.ReceivedValidFrame || MSTP_Port.ReceivedInvalidFrame; - if (received_frame) - break; - } while (bytes_remaining); - } - /* only do master state machine while rx is idle */ - if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE) { - if (MSTP_Port.This_Station <= DEFAULT_MAX_MASTER) { - while (MSTP_Master_Node_FSM(&MSTP_Port)) { - /* do nothing while some states fast transition */ - }; - } - } - /* see if there is a packet available, and a place - to put the reply (if necessary) and process it */ - if (Receive_Buffer.ready && !MSTP_Port.TxReady) { - if (Receive_Buffer.pdu_len) { - MSTP_Packets++; - npdu_handler(&Receive_Buffer.address, &Receive_Buffer.pdu[0], - Receive_Buffer.pdu_len); - } - Receive_Buffer.ready = false; - } - - return; -} - -void dlmstp_fill_bacnet_address(BACNET_ADDRESS *src, uint8_t mstp_address) -{ - int i = 0; - - if (mstp_address == MSTP_BROADCAST_ADDRESS) { - /* mac_len = 0 if broadcast address */ - src->mac_len = 0; - src->mac[0] = 0; - } else { - src->mac_len = 1; - src->mac[0] = mstp_address; - } - /* fill with 0's starting with index 1; index 0 filled above */ - for (i = 1; i < MAX_MAC_LEN; i++) { - src->mac[i] = 0; - } - src->net = 0; - src->len = 0; - for (i = 0; i < MAX_MAC_LEN; i++) { - src->adr[i] = 0; - } -} - -/* for the MS/TP state machine to use for putting received data */ -uint16_t dlmstp_put_receive(uint8_t src, /* source MS/TP address */ - uint8_t *pdu, /* PDU data */ - uint16_t pdu_len) -{ /* amount of PDU data */ - /* PDU is already in the Receive_Buffer */ - dlmstp_fill_bacnet_address(&Receive_Buffer.address, src); - Receive_Buffer.pdu_len = pdu_len; - Receive_Buffer.ready = true; -} - -void dlmstp_set_my_address(uint8_t mac_address) -{ - /* Master Nodes can only have address 0-127 */ - if (mac_address <= 127) { - MSTP_Port.This_Station = mac_address; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - mac_address, - EEPROM_MSTP_MAC_ADDR); */ - if (mac_address > MSTP_Port.Nmax_master) - dlmstp_set_max_master(mac_address); - } - - return; -} - -uint8_t dlmstp_my_address(void) -{ - return MSTP_Port.This_Station; -} - -/* This parameter represents the value of the Max_Info_Frames property of */ -/* the node's Device object. The value of Max_Info_Frames specifies the */ -/* maximum number of information frames the node may send before it must */ -/* pass the token. Max_Info_Frames may have different values on different */ -/* nodes. This may be used to allocate more or less of the available link */ -/* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ -/* node, its value shall be 1. */ -void dlmstp_set_max_info_frames(uint8_t max_info_frames) -{ - if (max_info_frames >= 1) { - MSTP_Port.Nmax_info_frames = max_info_frames; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - (uint8_t)max_info_frames, - EEPROM_MSTP_MAX_INFO_FRAMES_ADDR); */ - } - - return; -} - -unsigned dlmstp_max_info_frames(void) -{ - return MSTP_Port.Nmax_info_frames; -} - -/* This parameter represents the value of the Max_Master property of the */ -/* node's Device object. The value of Max_Master specifies the highest */ -/* allowable address for master nodes. The value of Max_Master shall be */ -/* less than or equal to 127. If Max_Master is not writable in a node, */ -/* its value shall be 127. */ -void dlmstp_set_max_master(uint8_t max_master) -{ - if (max_master <= 127) { - if (MSTP_Port.This_Station <= max_master) { - MSTP_Port.Nmax_master = max_master; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - max_master, - EEPROM_MSTP_MAX_MASTER_ADDR); */ - } - } - - return; -} - -uint8_t dlmstp_max_master(void) -{ - return MSTP_Port.Nmax_master; -} - -void dlmstp_get_my_address(BACNET_ADDRESS *my_address) -{ - int i = 0; /* counter */ - - my_address->mac_len = 1; - my_address->mac[0] = MSTP_Port.This_Station; - my_address->net = 0; /* local only, no routing */ - my_address->len = 0; - for (i = 0; i < MAX_MAC_LEN; i++) { - my_address->adr[i] = 0; - } - - return; -} - -void dlmstp_get_broadcast_address(BACNET_ADDRESS *dest) -{ /* destination address */ - int i = 0; /* counter */ - - if (dest) { - dest->mac_len = 1; - dest->mac[0] = MSTP_BROADCAST_ADDRESS; - dest->net = BACNET_BROADCAST_NETWORK; - dest->len = 0; /* always zero when DNET is broadcast */ - for (i = 0; i < MAX_MAC_LEN; i++) { - dest->adr[i] = 0; - } - } - - return; -} diff --git a/ports/pic18f6720/dlmstp.h b/ports/pic18f6720/dlmstp.h deleted file mode 100644 index f0b745e8..00000000 --- a/ports/pic18f6720/dlmstp.h +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef DLMSTP_H -#define DLMSTP_H - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/npdu.h" - -/* defines specific to MS/TP */ -#define DLMSTP_HEADER_MAX (2+1+1+1+2+1) -#define DLMSTP_MPDU_MAX (DLMSTP_HEADER_MAX+MAX_PDU) - -typedef struct dlmstp_packet { - bool ready; /* true if ready to be sent or received */ - BACNET_ADDRESS address; /* source address */ - uint8_t frame_type; /* type of message */ - unsigned pdu_len; /* packet length */ - uint8_t pdu[DLMSTP_MPDU_MAX]; /* packet */ -} DLMSTP_PACKET; - -/* number of MS/TP tx/rx packets */ -extern uint16_t MSTP_Packets; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void dlmstp_reinit( - void); - void dlmstp_init( - void); - void dlmstp_cleanup( - void); - void dlmstp_millisecond_timer( - void); - void dlmstp_task( - void); - - /* returns number of bytes sent on success, negative on failure */ - int dlmstp_send_pdu( - BACNET_ADDRESS * dest, /* destination address */ - BACNET_NPDU_DATA * npdu_data, /* network information */ - uint8_t * pdu, /* any data to be sent - may be null */ - unsigned pdu_len); /* number of bytes of data */ - - /* This parameter represents the value of the Max_Info_Frames property of */ - /* the node's Device object. The value of Max_Info_Frames specifies the */ - /* maximum number of information frames the node may send before it must */ - /* pass the token. Max_Info_Frames may have different values on different */ - /* nodes. This may be used to allocate more or less of the available link */ - /* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ - /* node, its value shall be 1. */ - void dlmstp_set_max_info_frames( - uint8_t max_info_frames); - unsigned dlmstp_max_info_frames( - void); - - /* This parameter represents the value of the Max_Master property of the */ - /* node's Device object. The value of Max_Master specifies the highest */ - /* allowable address for master nodes. The value of Max_Master shall be */ - /* less than or equal to 127. If Max_Master is not writable in a node, */ - /* its value shall be 127. */ - void dlmstp_set_max_master( - uint8_t max_master); - uint8_t dlmstp_max_master( - void); - - /* MAC address for MS/TP */ - void dlmstp_set_my_address( - uint8_t my_address); - uint8_t dlmstp_my_address( - void); - - /* BACnet address used in datalink */ - void dlmstp_get_my_address( - BACNET_ADDRESS * my_address); - void dlmstp_get_broadcast_address( - BACNET_ADDRESS * dest); /* destination address */ - - /* MS/TP state machine functions */ - uint16_t dlmstp_put_receive( - uint8_t src, /* source MS/TP address */ - uint8_t * pdu, /* PDU data */ - uint16_t pdu_len); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f6720/hardware.h b/ports/pic18f6720/hardware.h deleted file mode 100644 index cd35d85e..00000000 --- a/ports/pic18f6720/hardware.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************** -* -* Copyright (C) 2007 Steve Karg -* -* SPDX-License-Identifier: MIT -* -*********************************************************************/ -#ifndef HARDWARE_H -#define HARDWARE_H - -#include -#include -#include - -#define RS485_TX_ENABLE PORTEbits.RE3 -#define RS485_RX_DISABLE PORTGbits.RG0 - -#define TURN_OFF_COMPARATORS() CMCON = 0x07 - -enum INT_STATE { INT_DISABLED, INT_ENABLED, INT_RESTORE }; - -#define RESTART_WDT() { _asm CLRWDT _endasm } - -/* ************************************************************************* - define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1 - #define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0 - #define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1 - #define DISABLE_PERIPHERAL_INT() INTCONbits.PEIE = 0 - *************************************************************************** */ -#define ENABLE_HIGH_INT() INTCONbits.GIE = 1 -#define DISABLE_HIGH_INT() INTCONbits.GIE = 0 - -#define ENABLE_LOW_INT() INTCONbits.PEIE = 1 -#define DISABLE_LOW_INT() INTCONbits.PEIE = 0 - -#define ENABLE_TIMER0_INT() INTCONbits.TMR0IE = 1 -#define DISABLE_TIMER0_INT() INTCONbits.TMR0IE = 0 - -#define ENABLE_TIMER2_INT() PIE1bits.TMR2IE = 1 -#define DISABLE_TIMER2_INT() PIE1bits.TMR2IE = 0 - -#define ENABLE_TIMER4_INT() PIE3bits.TMR4IE = 1 -#define DISABLE_TIMER4_INT() PIE3bits.TMR4IE = 0 - -#define ENABLE_CCP2_INT() PIE2bits.CCP2IE = 1 -#define DISABLE_CCP2_INT() PIE2bits.CCP2IE = 0 - -#define ENABLE_CCP1_INT() PIE1bits.CCP1IE = 1 -#define DISABLE_CCP1_INT() PIE1bits.CCP1IE = 0 - -#define ENABLE_ABUS_INT() PIE1bits.SSPIE = 1 -#define DISABLE_ABUS_INT() PIE1bits.SSPIE = 0 -#define CLEAR_ABUS_FLAG() PIR1bits.SSPIF = 0 - -#define SETUP_CCP1(x) CCP1CON = x -#define SETUP_CCP2(x) CCP2CON = x - -#define DISABLE_RX_INT() PIE1bits.RCIE = 0 -#define ENABLE_RX_INT() PIE1bits.RCIE = 1 - -#define DISABLE_TX_INT() PIE1bits.TXIE = 0 -#define ENABLE_TX_INT() PIE1bits.TXIE = 1 - -#if CLOCKSPEED == 20 -#define DELAY_US(x) { _asm \ - MOVLW x \ - LOOP: \ - NOP \ - NOP \ - DECFSZ WREG, 1, 0 \ - BRA LOOP \ - _endasm } -#endif - -#define setup_timer4(mode, period, postscale) \ - T4CON = (mode | (postscale - 1) << 3); \ - PR4 = period - -#define setup_timer2(mode, period, postscale) \ - T2CON = (mode | (postscale - 1) << 3); \ - PR2 = period - -#endif /* HARDWARE_H */ diff --git a/ports/pic18f6720/isr.c b/ports/pic18f6720/isr.c deleted file mode 100644 index 2d4a1dce..00000000 --- a/ports/pic18f6720/isr.c +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include "stdint.h" -#include "hardware.h" -#include "rs485.h" -#include "bacnet/datalink/dlmstp.h" - -/* from main.c */ -extern volatile uint8_t Milliseconds; - -void InterruptHandlerHigh(void); -void InterruptHandlerLow(void); -void Interrupt_Timer2(void); -void Interrupt_Timer3(void); -void Interrupt_Timer4(void); -void Interrupt_USART_Rx(void); -void Interrupt_USART_Tx(void); -void Interrupt_CCP2(void); -void INT0_Interrupt(void); - -#pragma code InterruptVectorHigh = 0x08 -void InterruptVectorHigh(void) -{ - /* jump to interrupt routine */ - _asm goto InterruptHandlerHigh _endasm -} -#pragma code -#pragma code InterruptVectorLow = 0x18 -void InterruptVectorLow(void) -{ - /* jump to interrupt routine */ - _asm goto InterruptHandlerLow _endasm -} -#pragma code -#pragma interrupt InterruptHandlerHigh -void InterruptHandlerHigh(void) -{ -#if 0 - /* check for USART Rx int */ - if ((PIR1bits.RCIF) && (PIE1bits.RCIE)) { - if ((RCSTA1bits.FERR) || (RCSTA1bits.OERR)) { - Comstat.Rx_Bufferoverrun = TRUE; - PIE1bits.RC1IE = 0; /* Disable Interrupt on receipt */ - } else if (Comstat.Rx_Bytes++ < RX_BUFFER_SIZE - 1) { - Rx_Buffer[Comstat.RxHead++] = RCREG1; - - /* Stick a Null on the end to let us use str functions on our - * buffer */ - Rx_Buffer[Comstat.RxHead] = 0; - } else { - Comstat.Rx_Bufferoverrun = TRUE; - PIE1bits.RC1IE = 0; /* Disable Interrupt on receipt */ - } - } -#endif - - /* check for timer0 int */ - if ((INTCONbits.TMR0IF) && (INTCONbits.TMR0IE)) { - INTCONbits.TMR0IF = 0; - } -} - -#pragma interruptlow InterruptHandlerLow save = PROD, section(".tmpdata"), \ - TABLAT, TBLPTR, section("MATH_DATA") - -void InterruptHandlerLow(void) -{ - /* check for timer2 int */ - if ((PIR1bits.TMR2IF) && (PIE1bits.TMR2IE)) { - PIR1bits.TMR2IF = 0; - Interrupt_Timer2(); - } - - /* check for timer3 int */ - if ((PIR2bits.TMR3IF) && (PIE2bits.TMR3IE)) { - PIR2bits.TMR3IF = 0; - Interrupt_Timer3(); - } - - /* check for timer4 int */ - if ((PIR3bits.TMR4IF) && (PIE3bits.TMR4IE)) { - PIR3bits.TMR4IF = 0; - dlmstp_millisecond_timer(); - Interrupt_Timer4(); - } - - /* check for compare int */ - if ((PIR2bits.CCP2IF) && (PIE2bits.CCP2IE)) { - PIR2bits.CCP2IF = 0; - Interrupt_CCP2(); - } - - /* check for USART Tx int */ - if ((PIR3bits.TX2IF) && (PIE3bits.TX2IE)) { - RS485_Interrupt_Tx(); - } - - /* check for USART Rx int */ - if ((PIR3bits.RC2IF) && (PIE3bits.RC2IE)) { - RS485_Interrupt_Rx(); - } - - /* Unused Interrupts - //check for timer1 int - if ((PIR1bits.TMR1IF) && (PIE1bits.TMR1IE)) - { - PIR1bits.TMR1IF = 0; - Interrupt_Timer1(); - } - - //check for compare int - if ((PIR1bits.CCP1IF) && (PIE1bits.CCP1IE)) - { - PIR1bits.CCP1IF = 0; - Interrupt_CCP1(); - } - - //check for compare int - if ((PIR3bits.CCP3IF) && (PIE3bits.CCP3IE)) - { - PIR3bits.CCP3IF = 0; - Interrupt_CCP3(); - } - - //check for compare int - if ((PIR3bits.CCP4IF) && (PIE3bits.CCP4IE)) - { - PIR3bits.CCP4IF = 0; - - Interrupt_CCP4(); - } - - //check for AD int - if ((PIR1bits.ADIF) && (PIE1bits.ADIE)) - { - PIR1bits.ADIF = 0; - Interrupt_ADC(); - } - - //check for MSSP int - if ((PIR1bits.SSPIF) && (PIE1bits.SSPIE)) - { - PIR1bits.SSPIF = 0; - Interrupt_SSP(); - } - - */ -} - -void Interrupt_Timer2(void) -{ -} - -void Interrupt_Timer3(void) -{ -} - -/* Timer4 is set to go off every 1ms. This is our system tick */ -void Interrupt_Timer4(void) -{ - /* Milisecond is our system tick */ - if (Milliseconds < 0xFF) - ++Milliseconds; -} - -void Interrupt_CCP2(void) -{ -} diff --git a/ports/pic18f6720/main.c b/ports/pic18f6720/main.c deleted file mode 100644 index e969d873..00000000 --- a/ports/pic18f6720/main.c +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include /* for memmove */ -#include -#include -#include "stdint.h" -#include "hardware.h" -/* BACnet */ -#include "bacnet/apdu.h" -#include "bacnet/datalink/datalink.h" -#include "bacnet/dcc.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/tsm/tsm.h" -#include "rs485.h" - -/* chip configuration data */ -/* define this to enable ICD */ -/* #define USE_ICD */ - -/* Configuration Bits */ -#pragma config OSC = HS, OSCS = OFF -#pragma config PWRT = ON -#pragma config BOR = ON, BORV = 27 -#pragma config CCP2MUX = ON -#pragma config STVR = ON -#pragma config LVP = OFF -#pragma config CP0 = OFF -#pragma config CP1 = OFF -#pragma config CP2 = OFF -#pragma config CP3 = OFF -#pragma config CP4 = OFF -#pragma config CP5 = OFF -#pragma config CP6 = OFF -#pragma config CP7 = OFF -#pragma config CPB = OFF -#pragma config CPD = OFF -#pragma config WRT0 = OFF -#pragma config WRT1 = OFF -#pragma config WRT2 = OFF -#pragma config WRT3 = OFF -#pragma config WRT4 = OFF -#pragma config WRT5 = OFF -#pragma config WRT6 = OFF -#pragma config WRT7 = OFF -#pragma config WRTB = OFF -#pragma config WRTC = OFF -#pragma config WRTD = OFF -#pragma config EBTR0 = OFF -#pragma config EBTR1 = OFF -#pragma config EBTR2 = OFF -#pragma config EBTR3 = OFF -#pragma config EBTR4 = OFF -#pragma config EBTR5 = OFF -#pragma config EBTR6 = OFF -#pragma config EBTR7 = OFF -#pragma config EBTRB = OFF - -#ifdef USE_ICD -#pragma config WDT = OFF, WDTPS = 128 -#pragma config DEBUG = ON -#else -#pragma config WDT = ON, WDTPS = 128 -#pragma config DEBUG = OFF -#endif /* USE_ICD */ - -volatile uint8_t Milliseconds = 0; -volatile uint8_t Zero_Cross_Timeout = 0; - -void Reinitialize(void) -{ - uint8_t i; - char name = 0; - - _asm reset _endasm return; -} - -void Global_Int(enum INT_STATE state) -{ - static uint8_t intstate = 0; - - switch (state) { - case INT_DISABLED: - intstate >>= 2; - intstate |= (INTCON & 0xC0); - break; - case INT_ENABLED: - INTCONbits.GIE = 1; - INTCONbits.PEIE = 1; - intstate <<= 2; - break; - case INT_RESTORE: - INTCON |= (intstate & 0xC0); - intstate <<= 2; - break; - default: - break; - } -} - -void Hardware_Initialize(void) -{ - TRISA = 0x00; - TRISB = 0x00; - TRISC = 0x00; - TRISD = 0x00; - TRISE = 0x00; - TRISF = 0x00; - TRISG = 0x00; - /* We will use Timer4 as our system tick timer. Our system tick is set - * to 1ms. Hold off on enabling the int. */ - setup_timer4(5, 250, 5); - /* Setup our interrupt priorities */ - RCONbits.IPEN = 1; - IPR1 = 0; - IPR2 = 0; - IPR3 = 0; - /* Setup TMR0 to be high priority */ - INTCON2 = 0xFC; - INTCON3 = 0; - /* USART 1 high priority */ - IPR1bits.RC1IP = 1; - IPR1bits.TX1IP = 1; - /* Finally enable our ints */ - Global_Int(INT_ENABLED); -} - -void Initialize_Variables(void) -{ - /* Check to see if we need to initialize our eeproms */ - ENABLE_TIMER4_INT(); - /* interrupts must be enabled before we read our inputs */ - Global_Int(INT_ENABLED); - /* Start our time from now */ - Milliseconds = 0; -} - -void MainTasks(void) -{ - static uint16_t millisecond_counter = 0; - /* Handle our millisecond counters */ - while (Milliseconds) { - millisecond_counter++; - --Milliseconds; - } - /* Handle our seconds counters */ - if (millisecond_counter > 1000) { - millisecond_counter -= 1000; - dcc_timer_seconds(1); - } -} - -void main(void) -{ - RCONbits.NOT_POR = 1; - RCONbits.NOT_RI = 1; - Hardware_Initialize(); - Initialize_Variables(); - /* initialize BACnet Data Link Layer */ - dlmstp_set_my_address(42); - dlmstp_set_max_info_frames(1); - dlmstp_set_max_master(127); - RS485_Set_Baud_Rate(38400); - dlmstp_init(); - /* Handle anything that needs to be done on powerup */ - /* Greet the BACnet world! */ - Send_I_Am(&Handler_Transmit_Buffer[0]); - /* Main loop */ - while (TRUE) { - RESTART_WDT(); - dlmstp_task(); - MainTasks(); - Global_Int(INT_ENABLED); - ENABLE_TIMER4_INT(); - } -} diff --git a/ports/pic18f6720/mstp.c b/ports/pic18f6720/mstp.c deleted file mode 100644 index 46326782..00000000 --- a/ports/pic18f6720/mstp.c +++ /dev/null @@ -1,1242 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2003 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -/* This clause describes a Master-Slave/Token-Passing (MS/TP) data link */ -/* protocol, which provides the same services to the network layer as */ -/* ISO 8802-2 Logical Link Control. It uses services provided by the */ -/* EIA-485 physical layer. Relevant clauses of EIA-485 are deemed to be */ -/* included in this standard by reference. The following hardware is assumed: */ -/* (a) A UART (Universal Asynchronous Receiver/Transmitter) capable of */ -/* transmitting and receiving eight data bits with one stop bit */ -/* and no parity. */ -/* (b) An EIA-485 transceiver whose driver may be disabled. */ -/* (c) A timer with a resolution of five milliseconds or less */ - -#include -#include -#if PRINT_ENABLED -#include -#endif -/* BACnet Stack defines - first */ -#include "bacnet/bacdef.h" -/* BACnet Stack API */ -#include "bacnet/datalink/mstp.h" -#include "bacnet/bacaddr.h" -#if PRINT_ENABLED -#include "bacnet/datalink/mstptext.h" -#endif -/* port specific */ -#include "crc.h" -#include "rs485.h" - -/* debug print statements */ -#if PRINT_ENABLED -#define PRINT_ENABLED_RECEIVE 0 -#define PRINT_ENABLED_RECEIVE_DATA 1 -#define PRINT_ENABLED_MASTER 0 -#else -#define PRINT_ENABLED_RECEIVE 0 -#define PRINT_ENABLED_RECEIVE_DATA 0 -#define PRINT_ENABLED_MASTER 0 -#endif - -/* MS/TP Frame Format */ -/* All frames are of the following format: */ -/* */ -/* Preamble: two octet preamble: X`55', X`FF' */ -/* Frame Type: one octet */ -/* Destination Address: one octet address */ -/* Source Address: one octet address */ -/* Length: two octets, most significant octet first, of the Data field */ -/* Header CRC: one octet */ -/* Data: (present only if Length is non-zero) */ -/* Data CRC: (present only if Length is non-zero) two octets, */ -/* least significant octet first */ -/* (pad): (optional) at most one octet of padding: X'FF' */ - -/* The number of tokens received or used before a Poll For Master cycle */ -/* is executed: 50. */ -#define Npoll 50 - -/* The number of retries on sending Token: 1. */ -#define Nretry_token 1 - -/* The minimum number of DataAvailable or ReceiveError events that must be */ -/* seen by a receiving node in order to declare the line "active": 4. */ -#define Nmin_octets 4 - -/* The minimum time without a DataAvailable or ReceiveError event within */ -/* a frame before a receiving node may discard the frame: 60 bit times. */ -/* (Implementations may use larger values for this timeout, */ -/* not to exceed 100 milliseconds.) */ -/* At 9600 baud, 60 bit times would be about 6.25 milliseconds */ -/* const uint16_t Tframe_abort = 1 + ((1000 * 60) / 9600); */ -#ifndef Tframe_abort -#define Tframe_abort 30 -#endif - -/* The maximum time a node may wait after reception of a frame that expects */ -/* a reply before sending the first octet of a reply or Reply Postponed */ -/* frame: 250 milliseconds. */ -/* note: we always send a reply postponed since a message other than - the reply may be in the transmit queue */ -#ifndef Treply_delay -#define Treply_delay 10 -#endif - -/* The minimum time without a DataAvailable or ReceiveError event */ -/* that a node must wait for a station to begin replying to a */ -/* confirmed request: 255 milliseconds. (Implementations may use */ -/* larger values for this timeout, not to exceed 300 milliseconds.) */ -#ifndef Treply_timeout -#define Treply_timeout 255 -#endif - -/* Repeater turnoff delay. The duration of a continuous logical one state */ -/* at the active input port of an MS/TP repeater after which the repeater */ -/* will enter the IDLE state: 29 bit times < Troff < 40 bit times. */ -#ifndef Troff -#define Troff 30 -#endif - -/* The minimum time without a DataAvailable or ReceiveError event that a */ -/* node must wait for a remote node to begin using a token or replying to */ -/* a Poll For Master frame: 20 milliseconds. (Implementations may use */ -/* larger values for this timeout, not to exceed 100 milliseconds.) */ -#ifndef Tusage_timeout -#define Tusage_timeout 20 -#endif - -/* we need to be able to increment without rolling over */ -#define INCREMENT_AND_LIMIT_UINT8(x) \ - { \ - if (x < 0xFF) \ - x++; \ - } - -bool MSTP_Line_Active(const volatile struct mstp_port_struct_t *mstp_port) -{ - return (mstp_port->EventCount > Nmin_octets); -} - -unsigned MSTP_Create_Frame(uint8_t *buffer, /* where frame is loaded */ - unsigned buffer_len, /* amount of space available */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t *data, /* any data to be sent - may be null */ - unsigned data_len) -{ /* number of bytes of data (up to 501) */ - uint8_t crc8 = 0xFF; /* used to calculate the crc value */ - uint16_t crc16 = 0xFFFF; /* used to calculate the crc value */ - unsigned index = 0; /* used to load the data portion of the frame */ - - /* not enough to do a header */ - if (buffer_len < 8) - return 0; - - buffer[0] = 0x55; - buffer[1] = 0xFF; - buffer[2] = frame_type; - crc8 = CRC_Calc_Header(buffer[2], crc8); - buffer[3] = destination; - crc8 = CRC_Calc_Header(buffer[3], crc8); - buffer[4] = source; - crc8 = CRC_Calc_Header(buffer[4], crc8); - buffer[5] = HI_BYTE(data_len); - crc8 = CRC_Calc_Header(buffer[5], crc8); - buffer[6] = LO_BYTE(data_len); - crc8 = CRC_Calc_Header(buffer[6], crc8); - buffer[7] = ~crc8; - - index = 8; - while (data_len && data && (index < buffer_len)) { - buffer[index] = *data; - crc16 = CRC_Calc_Data(buffer[index], crc16); - data++; - index++; - data_len--; - } - /* append the data CRC if necessary */ - if (index > 8) { - if ((index + 2) <= buffer_len) { - crc16 = ~crc16; - buffer[index] = LO_BYTE(crc16); - index++; - buffer[index] = HI_BYTE(crc16); - index++; - } else - return 0; - } - - return index; /* returns the frame length */ -} - -void MSTP_Create_And_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port to send from */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t *data, /* any data to be sent - may be null */ - unsigned data_len) -{ /* number of bytes of data (up to 501) */ - uint8_t buffer[DLMSTP_MPDU_MAX] = { 0 }; /* buffer for sending */ - uint16_t len = 0; /* number of bytes to send */ - - len = (uint16_t)MSTP_Create_Frame(&buffer[0], /* where frame is loaded */ - sizeof(buffer), /* amount of space available */ - frame_type, /* type of frame to send - see defines */ - destination, /* destination address */ - source, /* source address */ - data, /* any data to be sent - may be null */ - data_len); /* number of bytes of data (up to 501) */ - - RS485_Send_Frame(mstp_port, &buffer[0], len); - /* FIXME: be sure to reset SilenceTimer after each octet is sent! */ -} - -void MSTP_Receive_Frame_FSM(volatile struct mstp_port_struct_t *mstp_port) -{ -#if PRINT_ENABLED_RECEIVE_DATA - static MSTP_RECEIVE_STATE receive_state = MSTP_RECEIVE_STATE_IDLE; -#endif -#if PRINT_ENABLED_RECEIVE - fprintf(stderr, - "MSTP Rx: State=%s Data=%02X hCRC=%02X Index=%u EC=%u DateLen=%u " - "Silence=%u\n", - mstptext_receive_state(mstp_port->receive_state), - mstp_port->DataRegister, mstp_port->HeaderCRC, mstp_port->Index, - mstp_port->EventCount, mstp_port->DataLength, mstp_port->SilenceTimer); -#endif - switch (mstp_port->receive_state) { - /* In the IDLE state, the node waits for the beginning of a frame. - */ - case MSTP_RECEIVE_STATE_IDLE: - /* EatAnError */ - if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "MSTP Rx: %02X ", mstp_port->DataRegister); -#endif - /* Preamble1 */ - if (mstp_port->DataRegister == 0x55) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* receive the remainder of the frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_PREAMBLE; - } - /* EatAnOctet */ - else { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "\n"); -#endif - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the PREAMBLE state, the node waits for the second octet of the - * preamble. */ - case MSTP_RECEIVE_STATE_PREAMBLE: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* a correct preamble has not been received */ - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* Preamble2 */ - if (mstp_port->DataRegister == 0xFF) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->Index = 0; - mstp_port->HeaderCRC = 0xFF; - /* receive the remainder of the frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* ignore RepeatedPreamble1 */ - else if (mstp_port->DataRegister == 0x55) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the second preamble octet. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_PREAMBLE; - } - /* NotPreamble */ - else { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the HEADER state, the node waits for the fixed message header. - */ - case MSTP_RECEIVE_STATE_HEADER: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* FrameType */ - if (mstp_port->Index == 0) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->FrameType = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 1; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Destination */ - else if (mstp_port->Index == 1) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DestinationAddress = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 2; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Source */ - else if (mstp_port->Index == 2) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->SourceAddress = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 3; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Length1 */ - else if (mstp_port->Index == 3) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataLength = mstp_port->DataRegister * 256; - mstp_port->DataAvailable = false; - mstp_port->Index = 4; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Length2 */ - else if (mstp_port->Index == 4) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataLength += mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 5; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* HeaderCRC */ - else if (mstp_port->Index == 5) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataAvailable = false; - /* don't wait for next state - do it here */ - if (mstp_port->HeaderCRC != 0x55) { - /* BadCRC */ - /* indicate that an error has occurred during the - * reception of a frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else { - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) || - (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS)) { - /* FrameTooLong */ - if (mstp_port->DataLength > DLMSTP_MPDU_MAX) { - /* indicate that a frame with an illegal or */ - /* unacceptable data length has been received */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_IDLE; - } - /* NoData */ - else if (mstp_port->DataLength == 0) { - /* indicate that a frame with no data has been - * received */ - mstp_port->ReceivedValidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_IDLE; - } - /* Data */ - else { - mstp_port->Index = 0; - mstp_port->DataCRC = 0xFFFF; - /* receive the data portion of the frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_DATA; - } - } - /* NotForUs */ - else { - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - - } - /* not per MS/TP standard, but it is a case not covered */ - else { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* indicate that an error has occurred during */ - /* the reception of a frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the DATA state, the node waits for the data portion of a - * frame. */ - case MSTP_RECEIVE_STATE_DATA: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* DataOctet */ - if (mstp_port->Index < mstp_port->DataLength) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - mstp_port->InputBuffer[mstp_port->Index] = - mstp_port->DataRegister; - mstp_port->Index++; - mstp_port->receive_state = MSTP_RECEIVE_STATE_DATA; - } - /* CRC1 */ - else if (mstp_port->Index == mstp_port->DataLength) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - mstp_port->Index++; - mstp_port->receive_state = MSTP_RECEIVE_STATE_DATA; - } - /* CRC2 */ - else if (mstp_port->Index == (mstp_port->DataLength + 1)) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - /* STATE DATA CRC - no need for new state */ - /* indicate the complete reception of a valid frame */ - if (mstp_port->DataCRC == 0xF0B8) - mstp_port->ReceivedValidFrame = true; - else - mstp_port->ReceivedInvalidFrame = true; - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - } - break; - default: - /* shouldn't get here - but if we do... */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - break; - } -#if PRINT_ENABLED_RECEIVE_DATA - if ((receive_state != MSTP_RECEIVE_STATE_IDLE) && - (mstp_port->receive_state == MSTP_RECEIVE_STATE_IDLE)) { - fprintf(stderr, "\n"); - fflush(stderr); - } - receive_state = mstp_port->receive_state; -#endif - - return; -} - -static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu, - uint16_t request_pdu_len, - uint8_t src_address, - uint8_t *reply_pdu, - uint16_t reply_pdu_len, - uint8_t dest_address) -{ - uint16_t offset; - /* One way to check the message is to compare NPDU - src, dest, along with the APDU type, invoke id. - Seems a bit overkill */ - struct DER_compare_t { - BACNET_NPDU_DATA npdu_data; - BACNET_ADDRESS address; - uint8_t pdu_type; - uint8_t invoke_id; - uint8_t service_choice; - }; - struct DER_compare_t request; - struct DER_compare_t reply; - - /* decode the request data */ - request.address.mac[0] = src_address; - request.address.mac_len = 1; - offset = bacnet_npdu_decode(request_pdu, request_pdu_len, NULL, - &request.address, &request.npdu_data); - if (request.npdu_data.network_layer_message) { - return false; - } - request.pdu_type = request_pdu[offset] & 0xF0; - if (request.pdu_type != PDU_TYPE_CONFIRMED_SERVICE_REQUEST) { - return false; - } - request.invoke_id = request_pdu[offset + 2]; - /* segmented message? */ - if (request_pdu[offset] & BIT(3)) - request.service_choice = request_pdu[offset + 5]; - else - request.service_choice = request_pdu[offset + 3]; - /* decode the reply data */ - reply.address.mac[0] = dest_address; - reply.address.mac_len = 1; - offset = bacnet_npdu_decode( - reply_pdu, reply_pdu_len, &reply.address, NULL, &reply.npdu_data); - if (reply.npdu_data.network_layer_message) { - return false; - } - /* reply could be a lot of things: - confirmed, simple ack, abort, reject, error */ - reply.pdu_type = reply_pdu[offset] & 0xF0; - switch (reply.pdu_type) { - case PDU_TYPE_SIMPLE_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_COMPLEX_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - /* segmented message? */ - if (reply_pdu[offset] & BIT(3)) - reply.service_choice = reply_pdu[offset + 4]; - else - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_ERROR: - reply.invoke_id = reply_pdu[offset + 1]; - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_REJECT: - case PDU_TYPE_ABORT: - case PDU_TYPE_SEGMENT_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - break; - default: - return false; - } - if (request.invoke_id != reply.invoke_id) { - return false; - } - /* these services don't have service choice included */ - if ((reply.pdu_type != PDU_TYPE_REJECT) && - (reply.pdu_type != PDU_TYPE_ABORT) && - (reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) { - if (request.service_choice != reply.service_choice) { - return false; - } - } - if (request.npdu_data.protocol_version != - reply.npdu_data.protocol_version) { - return false; - } - if (request.npdu_data.priority != reply.npdu_data.priority) { - return false; - } - if (!bacnet_address_same(&request.address, &reply.address)) { - return false; - } - - return true; -} - -/* returns true if we need to transition immediately */ -bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port) -{ - int mtu_len = 0; - int frame_type = 0; - uint8_t next_poll_station = 0; - uint8_t next_this_station = 0; - uint8_t next_next_station = 0; - uint16_t my_timeout = 10, ns_timeout = 0; - /* transition immediately to the next state */ - bool transition_now = false; - bool matched = false; -#if PRINT_ENABLED_MASTER - static MSTP_MASTER_STATE master_state = MSTP_MASTER_STATE_INITIALIZE; -#endif - - /* some calculations that several states need */ - next_poll_station = - (mstp_port->Poll_Station + 1) % (mstp_port->Nmax_master + 1); - next_this_station = - (mstp_port->This_Station + 1) % (mstp_port->Nmax_master + 1); - next_next_station = - (mstp_port->Next_Station + 1) % (mstp_port->Nmax_master + 1); -#if PRINT_ENABLED_MASTER - if (mstp_port->master_state != master_state) { - master_state = mstp_port->master_state; - fprintf(stderr, - "MSTP: TS=%02X[%02X] NS=%02X[%02X] PS=%02X[%02X] EC=%u TC=%u ST=%u " - "%s\n", - mstp_port->This_Station, next_this_station, mstp_port->Next_Station, - next_next_station, mstp_port->Poll_Station, next_poll_station, - mstp_port->EventCount, mstp_port->TokenCount, - mstp_port->SilenceTimer, - mstptext_master_state(mstp_port->master_state)); - } -#endif - - switch (mstp_port->master_state) { - case MSTP_MASTER_STATE_INITIALIZE: - /* DoneInitializing */ - /* indicate that the next station is unknown */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->Poll_Station = mstp_port->This_Station; - /* cause a Poll For Master to be sent when this node first */ - /* receives the token */ - mstp_port->TokenCount = Npoll; - mstp_port->SoleMaster = false; - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - break; - /* In the IDLE state, the node waits for a frame. */ - case MSTP_MASTER_STATE_IDLE: - /* LostToken */ - if (mstp_port->SilenceTimer >= Tno_token) { - /* assume that the token has been lost */ - mstp_port->EventCount = 0; /* Addendum 135-2004d-8 */ - mstp_port->master_state = MSTP_MASTER_STATE_NO_TOKEN; - /* set the receive frame flags to false in case we received - some bytes and had a timeout for some reason */ - mstp_port->ReceivedInvalidFrame = false; - mstp_port->ReceivedValidFrame = false; - transition_now = true; - } - /* ReceivedInvalidFrame */ - else if (mstp_port->ReceivedInvalidFrame == true) { - /* invalid frame was received */ - mstp_port->ReceivedInvalidFrame = false; - /* wait for the next frame - remain in IDLE */ - } else if (mstp_port->ReceivedValidFrame == true) { -#if PRINT_ENABLED_MASTER - fprintf(stderr, - "MSTP: ReceivedValidFrame Src=%02X Dest=%02X DataLen=%u " - "FC=%u ST=%u Type=%s\n", - mstp_port->SourceAddress, mstp_port->DestinationAddress, - mstp_port->DataLength, mstp_port->FrameCount, - mstp_port->SilenceTimer, - mstptext_frame_type(mstp_port->FrameType)); -#endif - /* destined for me! */ - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) || - (mstp_port->DestinationAddress == MSTP_BROADCAST_ADDRESS)) { - switch (mstp_port->FrameType) { - /* ReceivedToken */ - case FRAME_TYPE_TOKEN: - /* tokens can't be broadcast */ - if (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) - break; - mstp_port->ReceivedValidFrame = false; - mstp_port->FrameCount = 0; - mstp_port->SoleMaster = false; - mstp_port->master_state = - MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - break; - /* ReceivedPFM */ - case FRAME_TYPE_POLL_FOR_MASTER: - /* DestinationAddress is equal to TS */ - if (mstp_port->DestinationAddress == - mstp_port->This_Station) { - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER, - mstp_port->SourceAddress, - mstp_port->This_Station, NULL, 0); - } - break; - case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY: - if ((mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) && - (npdu_confirmed_service(mstp_port->InputBuffer, - mstp_port->DataLength))) { - /* BTL test: verifies that the IUT will quietly - discard any Confirmed-Request-PDU, whose - destination address is a multicast or - broadcast address, received from the - network layer. */ - } else { - /* indicate successful reception to the higher - * layers */ - dlmstp_put_receive(mstp_port->SourceAddress, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - } - break; - case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: - if (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) { - /* broadcast DER just remains IDLE */ - } else { - /* indicate successful reception to the higher - * layers */ - dlmstp_put_receive(mstp_port->SourceAddress, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - mstp_port->master_state = - MSTP_MASTER_STATE_ANSWER_DATA_REQUEST; - } - break; - case FRAME_TYPE_TEST_REQUEST: - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_TEST_RESPONSE, - mstp_port->SourceAddress, - mstp_port->This_Station, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - break; - case FRAME_TYPE_TEST_RESPONSE: - default: - break; - } - } - mstp_port->ReceivedValidFrame = false; - } - break; - /* In the USE_TOKEN state, the node is allowed to send one or */ - /* more data frames. These may be BACnet Data frames or */ - /* proprietary frames. */ - case MSTP_MASTER_STATE_USE_TOKEN: - if (!mstp_port->TxReady) { - /* NothingToSend */ - mstp_port->FrameCount = mstp_port->Nmax_info_frames; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - transition_now = true; - } else { - uint8_t destination = mstp_port->TxBuffer[3]; - RS485_Send_Frame(mstp_port, (uint8_t *)&mstp_port->TxBuffer[0], - mstp_port->TxLength); - mstp_port->FrameCount++; - switch (mstp_port->TxFrameType) { - case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: - /* SendAndWait */ - if (destination == MSTP_BROADCAST_ADDRESS) - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - else - mstp_port->master_state = - MSTP_MASTER_STATE_WAIT_FOR_REPLY; - break; - case FRAME_TYPE_TEST_REQUEST: - mstp_port->master_state = - MSTP_MASTER_STATE_WAIT_FOR_REPLY; - break; - case FRAME_TYPE_TEST_RESPONSE: - case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY: - default: - /* SendNoWait */ - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - } - mstp_port->TxReady = false; - } - break; - /* In the WAIT_FOR_REPLY state, the node waits for */ - /* a reply from another node. */ - case MSTP_MASTER_STATE_WAIT_FOR_REPLY: - if (mstp_port->SilenceTimer >= Treply_timeout) { - /* ReplyTimeout */ - /* assume that the request has failed */ - mstp_port->FrameCount = mstp_port->Nmax_info_frames; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - /* Any retry of the data frame shall await the next entry */ - /* to the USE_TOKEN state. (Because of the length of the - * timeout, */ - /* this transition will cause the token to be passed regardless - */ - /* of the initial value of FrameCount.) */ - transition_now = true; - } else { - if (mstp_port->ReceivedInvalidFrame == true) { - /* InvalidFrame */ - /* error in frame reception */ - mstp_port->ReceivedInvalidFrame = false; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - transition_now = true; - } else if (mstp_port->ReceivedValidFrame == true) { - if (mstp_port->DestinationAddress == - mstp_port->This_Station) { - switch (mstp_port->FrameType) { - case FRAME_TYPE_REPLY_POSTPONED: - /* ReceivedReplyPostponed */ - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - case FRAME_TYPE_TEST_RESPONSE: - mstp_port->master_state = - MSTP_MASTER_STATE_IDLE; - break; - case FRAME_TYPE_TOKEN: - case FRAME_TYPE_POLL_FOR_MASTER: - case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER: - case FRAME_TYPE_TEST_REQUEST: - /* ReceivedUnexpectedFrame */ - /* FrameType has a value other than a FrameType - known to this node that indicates a reply */ - mstp_port->master_state = - MSTP_MASTER_STATE_IDLE; - break; - default: - /* ReceivedReply */ - /* FrameType known to this node that - indicates a reply */ - /* indicate successful reception - to the higher layers */ - dlmstp_put_receive( - mstp_port->SourceAddress, /* source MS/TP - address */ - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - } - } else { - /* ReceivedUnexpectedFrame */ - /* an unexpected frame was received */ - /* This may indicate the presence of multiple tokens. */ - /* Synchronize with the network. */ - /* This action drops the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } - mstp_port->ReceivedValidFrame = false; - transition_now = true; - } - } - break; - /* The DONE_WITH_TOKEN state either sends another data frame, */ - /* passes the token, or initiates a Poll For Master cycle. */ - case MSTP_MASTER_STATE_DONE_WITH_TOKEN: - /* SendAnotherFrame */ - if (mstp_port->FrameCount < mstp_port->Nmax_info_frames) { - /* then this node may send another information frame */ - /* before passing the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else if ((mstp_port->SoleMaster == false) && - (mstp_port->Next_Station == mstp_port->This_Station)) { - /* NextStationUnknown - added in Addendum 135-2008v-1 */ - /* then the next station to which the token - should be sent is unknown - so PollForMaster */ - mstp_port->Poll_Station = next_this_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - /* Npoll changed in Errata SSPC-135-2004 */ - else if (mstp_port->TokenCount < (Npoll - 1)) { - if ((mstp_port->SoleMaster == true) && - (mstp_port->Next_Station != next_this_station)) { - /* SoleMaster */ - /* there are no other known master nodes to */ - /* which the token may be sent (true master-slave - * operation). */ - mstp_port->FrameCount = 0; - mstp_port->TokenCount++; - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else { - /* SendToken */ - /* Npoll changed in Errata SSPC-135-2004 */ - /* The comparison of NS and TS+1 eliminates the Poll For - * Master */ - /* if there are no addresses between TS and NS, since there - * is no */ - /* address at which a new master node may be found in that - * case. */ - mstp_port->TokenCount++; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->RetryCount = 0; - mstp_port->EventCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } - } else if (next_poll_station == mstp_port->Next_Station) { - if (mstp_port->SoleMaster == true) { - /* SoleMasterRestartMaintenancePFM */ - mstp_port->Poll_Station = next_next_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* no known successor node */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = - 1; /* changed in Errata SSPC-135-2004 */ - /* mstp_port->EventCount = 0; removed in Addendum - * 135-2004d-8 */ - /* find a new successor to TS */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } else { - /* ResetMaintenancePFM */ - mstp_port->Poll_Station = mstp_port->This_Station; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->RetryCount = 0; - mstp_port->TokenCount = - 1; /* changed in Errata SSPC-135-2004 */ - mstp_port->EventCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } - } else { - /* SendMaintenancePFM */ - mstp_port->Poll_Station = next_poll_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - break; - /* The PASS_TOKEN state listens for a successor to begin using */ - /* the token that this node has just attempted to pass. */ - case MSTP_MASTER_STATE_PASS_TOKEN: - if (mstp_port->SilenceTimer < Tusage_timeout) { - if (mstp_port->EventCount > Nmin_octets) { - /* SawTokenUser */ - /* Assume that a frame has been sent by the new token user. - */ - /* Enter the IDLE state to process the frame. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - } else { - if (mstp_port->RetryCount < Nretry_token) { - /* RetrySendToken */ - mstp_port->RetryCount++; - /* Transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->EventCount = 0; - /* re-enter the current state to listen for NS */ - /* to begin using the token. */ - } else { - /* FindNewSuccessor */ - /* Assume that NS has failed. */ - /* note: if NS=TS-1, this node could send PFM to self! */ - mstp_port->Poll_Station = next_next_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* no known successor node */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = 0; - /* mstp_port->EventCount = 0; removed in Addendum - * 135-2004d-8 */ - /* find a new successor to TS */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - } - break; - /* The NO_TOKEN state is entered if mstp_port->SilenceTimer becomes - * greater */ - /* than Tno_token, indicating that there has been no network - * activity */ - /* for that period of time. The timeout is continued to determine */ - /* whether or not this node may create a token. */ - case MSTP_MASTER_STATE_NO_TOKEN: - my_timeout = Tno_token + (Tslot * mstp_port->This_Station); - if (mstp_port->SilenceTimer < my_timeout) { - if (mstp_port->EventCount > Nmin_octets) { - /* SawFrame */ - /* Some other node exists at a lower address. */ - /* Enter the IDLE state to receive and process the incoming - * frame. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - } else { - ns_timeout = - Tno_token + (Tslot * (mstp_port->This_Station + 1)); - if (mstp_port->SilenceTimer < ns_timeout) { - /* GenerateToken */ - /* Assume that this node is the lowest numerical address */ - /* on the network and is empowered to create a token. */ - mstp_port->Poll_Station = next_this_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* indicate that the next station is unknown */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = 0; - /* mstp_port->EventCount = 0; removed Addendum 135-2004d-8 - */ - /* enter the POLL_FOR_MASTER state to find a new successor - * to TS. */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - } - break; - /* In the POLL_FOR_MASTER state, the node listens for a reply to */ - /* a previously sent Poll For Master frame in order to find */ - /* a successor node. */ - case MSTP_MASTER_STATE_POLL_FOR_MASTER: - if (mstp_port->ReceivedValidFrame == true) { - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) && - (mstp_port->FrameType == - FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER)) { - /* ReceivedReplyToPFM */ - mstp_port->SoleMaster = false; - mstp_port->Next_Station = mstp_port->SourceAddress; - mstp_port->EventCount = 0; - /* Transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->Poll_Station = mstp_port->This_Station; - mstp_port->TokenCount = 0; - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } else { - /* ReceivedUnexpectedFrame */ - /* An unexpected frame was received. */ - /* This may indicate the presence of multiple tokens. */ - /* enter the IDLE state to synchronize with the network. */ - /* This action drops the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - mstp_port->ReceivedValidFrame = false; - } else if ((mstp_port->SilenceTimer >= Tusage_timeout) || - (mstp_port->ReceivedInvalidFrame == true)) { - if (mstp_port->SoleMaster == true) { - /* SoleMaster */ - /* There was no valid reply to the periodic poll */ - /* by the sole known master for other masters. */ - mstp_port->FrameCount = 0; - /* mstp_port->TokenCount++; removed in 2004 */ - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else { - if (mstp_port->Next_Station != mstp_port->This_Station) { - /* DoneWithPFM */ - /* There was no valid reply to the maintenance */ - /* poll for a master at address PS. */ - mstp_port->EventCount = 0; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, - NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } else { - if (next_poll_station != mstp_port->This_Station) { - /* SendNextPFM */ - mstp_port->Poll_Station = next_poll_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, - mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - /* Re-enter the current state. */ - } else { - /* DeclareSoleMaster */ - /* to indicate that this station is the only master - */ - mstp_port->SoleMaster = true; - mstp_port->FrameCount = 0; - mstp_port->master_state = - MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } - } - } - mstp_port->ReceivedInvalidFrame = false; - } - break; - /* The ANSWER_DATA_REQUEST state is entered when a */ - /* BACnet Data Expecting Reply, a Test_Request, or */ - /* a proprietary frame that expects a reply is received. */ - case MSTP_MASTER_STATE_ANSWER_DATA_REQUEST: - if (mstp_port->TxReady) { - /* Compare the APDU type received and - see if the message is that same APDU type - along with the matching src/dest and invoke ID */ - matched = mstp_compare_data_expecting_reply( - &mstp_port->InputBuffer[0], mstp_port->DataLength, - mstp_port->SourceAddress, &mstp_port->TxBuffer[8], - mstp_port->TxLength, mstp_port->TxDestination); - } - if (matched && mstp_port->TxReady) { - /* Reply */ - /* If a reply is available from the higher layers */ - /* within Treply_delay after the reception of the */ - /* final octet of the requesting frame */ - /* (the mechanism used to determine this is a local matter), */ - /* then call MSTP_Create_And_Send_Frame to transmit the reply - * frame */ - /* and enter the IDLE state to wait for the next frame. */ - RS485_Send_Frame(mstp_port, (uint8_t *)&mstp_port->TxBuffer[0], - mstp_port->TxLength); - mstp_port->TxReady = false; - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } else if (mstp_port->SilenceTimer > Treply_delay) { - /* DeferredReply */ - /* If no reply will be available from the higher layers */ - /* within Treply_delay after the reception of the */ - /* final octet of the requesting frame (the mechanism */ - /* used to determine this is a local matter), */ - /* then an immediate reply is not possible. */ - /* Any reply shall wait until this node receives the token. */ - /* Call MSTP_Create_And_Send_Frame to transmit a */ - /* Reply Postponed frame, and enter the IDLE state. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_REPLY_POSTPONED, mstp_port->SourceAddress, - mstp_port->This_Station, NULL, 0); - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } - break; - default: - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - break; - } - - return transition_now; -} - -/* note: This_Station should be set with the MAC address */ -/* note: Nmax_info_frames should be set */ -/* note: Nmax_master should be set */ -void MSTP_Init(volatile struct mstp_port_struct_t *mstp_port) -{ - int i; /*loop counter */ - - if (mstp_port) { - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - mstp_port->master_state = MSTP_MASTER_STATE_INITIALIZE; - mstp_port->ReceiveError = false; - mstp_port->DataAvailable = false; - mstp_port->DataRegister = 0; - mstp_port->DataCRC = 0; - mstp_port->DataCRC = 0; - mstp_port->DataLength = 0; - mstp_port->DestinationAddress = 0; - mstp_port->EventCount = 0; - mstp_port->FrameType = FRAME_TYPE_TOKEN; - mstp_port->FrameCount = 0; - mstp_port->HeaderCRC = 0; - mstp_port->Index = 0; - mstp_port->Index = 0; - for (i = 0; i < sizeof(mstp_port->InputBuffer); i++) { - mstp_port->InputBuffer[i] = 0; - } - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->Poll_Station = mstp_port->This_Station; - mstp_port->ReceivedInvalidFrame = false; - mstp_port->ReceivedValidFrame = false; - mstp_port->RetryCount = 0; - mstp_port->SilenceTimer = 0; - /* mstp_port->ReplyPostponedTimer = 0; */ - mstp_port->SoleMaster = false; - mstp_port->SourceAddress = 0; - mstp_port->TokenCount = 0; -#if 0 - /* these are adjustable, so should already be set */ - mstp_port->Nmax_info_frames = DEFAULT_MAX_INFO_FRAMES; - mstp_port->Nmax_master = DEFAULT_MAX_MASTER; -#endif - - /* An array of octets, used to store PDU octets prior to being - * transmitted. */ - /* This array is only used for APDU messages */ - for (i = 0; i < sizeof(mstp_port->TxBuffer); i++) { - mstp_port->TxBuffer[i] = 0; - } - mstp_port->TxLength = 0; - mstp_port->TxReady = false; - mstp_port->TxFrameType = 0; - } -} diff --git a/ports/pic18f6720/mstp.h b/ports/pic18f6720/mstp.h deleted file mode 100644 index 8ee2abf1..00000000 --- a/ports/pic18f6720/mstp.h +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2004 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef MSTP_H -#define MSTP_H - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/datalink/mstpdef.h" -#include "bacnet/datalink/dlmstp.h" - -struct mstp_port_struct_t { - MSTP_RECEIVE_STATE receive_state; - /* When a master node is powered up or reset, */ - /* it shall unconditionally enter the INITIALIZE state. */ - MSTP_MASTER_STATE master_state; - /* A Boolean flag set to TRUE by the Receive State Machine */ - /* if an error is detected during the reception of a frame. */ - /* Set to FALSE by the main state machine. */ - unsigned ReceiveError:1; - /* There is data in the buffer */ - unsigned DataAvailable:1; - unsigned ReceivedInvalidFrame:1; - /* A Boolean flag set to TRUE by the Receive State Machine */ - /* if a valid frame is received. */ - /* Set to FALSE by the main state machine. */ - unsigned ReceivedValidFrame:1; - /* A Boolean flag set to TRUE by the master machine if this node is the */ - /* only known master node. */ - unsigned SoleMaster:1; - /* stores the latest received data */ - uint8_t DataRegister; - /* Used to accumulate the CRC on the data field of a frame. */ - uint16_t DataCRC; - /* Used to store the data length of a received frame. */ - unsigned DataLength; - /* Used to store the destination address of a received frame. */ - uint8_t DestinationAddress; - /* Used to count the number of received octets or errors. */ - /* This is used in the detection of link activity. */ - /* Compared to Nmin_octets */ - uint8_t EventCount; - /* Used to store the frame type of a received frame. */ - uint8_t FrameType; - /* The number of frames sent by this node during a single token hold. */ - /* When this counter reaches the value Nmax_info_frames, the node must */ - /* pass the token. */ - unsigned FrameCount; - /* Used to accumulate the CRC on the header of a frame. */ - uint8_t HeaderCRC; - /* Used as an index by the Receive State Machine, up to a maximum value of */ - /* InputBufferSize. */ - unsigned Index; - /* An array of octets, used to store octets as they are received. */ - /* InputBuffer is indexed from 0 to InputBufferSize-1. */ - /* The maximum size of a frame is 501 octets. */ - uint8_t *InputBuffer; - /* "Next Station," the MAC address of the node to which This Station passes */ - /* the token. If the Next_Station is unknown, Next_Station shall be equal to */ - /* This_Station. */ - uint8_t Next_Station; - /* "Poll Station," the MAC address of the node to which This Station last */ - /* sent a Poll For Master. This is used during token maintenance. */ - uint8_t Poll_Station; - /* A counter of transmission retries used for Token and Poll For Master */ - /* transmission. */ - unsigned RetryCount; - /* A timer with nominal 5 millisecond resolution used to measure and */ - /* generate silence on the medium between octets. It is incremented by a */ - /* timer process and is cleared by the Receive State Machine when activity */ - /* is detected and by the SendFrame procedure as each octet is transmitted. */ - /* Since the timer resolution is limited and the timer is not necessarily */ - /* synchronized to other machine events, a timer value of N will actually */ - /* denote intervals between N-1 and N */ - uint16_t SilenceTimer; - - /* A timer used to measure and generate Reply Postponed frames. It is */ - /* incremented by a timer process and is cleared by the Master Node State */ - /* Machine when a Data Expecting Reply Answer activity is completed. */ -/* note: we always send a reply postponed since a message other than - the reply may be in the transmit queue */ -/* uint16_t ReplyPostponedTimer; */ - - /* Used to store the Source Address of a received frame. */ - uint8_t SourceAddress; - - /* The number of tokens received by this node. When this counter reaches the */ - /* value Npoll, the node polls the address range between TS and NS for */ - /* additional master nodes. TokenCount is set to zero at the end of the */ - /* polling process. */ - unsigned TokenCount; - - /* "This Station," the MAC address of this node. TS is generally read from a */ - /* hardware DIP switch, or from nonvolatile memory. Valid values for TS are */ - /* 0 to 254. The value 255 is used to denote broadcast when used as a */ - /* destination address but is not allowed as a value for TS. */ - uint8_t This_Station; - - /* This parameter represents the value of the Max_Info_Frames property of */ - /* the node's Device object. The value of Max_Info_Frames specifies the */ - /* maximum number of information frames the node may send before it must */ - /* pass the token. Max_Info_Frames may have different values on different */ - /* nodes. This may be used to allocate more or less of the available link */ - /* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ - /* node, its value shall be 1. */ - unsigned Nmax_info_frames; - - /* This parameter represents the value of the Max_Master property of the */ - /* node's Device object. The value of Max_Master specifies the highest */ - /* allowable address for master nodes. The value of Max_Master shall be */ - /* less than or equal to 127. If Max_Master is not writable in a node, */ - /* its value shall be 127. */ - unsigned Nmax_master; - - /* An array of octets, used to store PDU octets prior to being transmitted. */ - /* This array is only used for APDU messages */ - uint8_t TxBuffer[MAX_MPDU]; - unsigned TxLength; - uint8_t TxDestination; - bool TxReady; /* true if ready to be sent or received */ - uint8_t TxFrameType; /* type of message - needed by MS/TP */ -}; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void MSTP_Init( - volatile struct mstp_port_struct_t *mstp_port); - void MSTP_Receive_Frame_FSM( - volatile struct mstp_port_struct_t - *mstp_port); - bool MSTP_Master_Node_FSM( - volatile struct mstp_port_struct_t - *mstp_port); - - /* returns true if line is active */ - bool MSTP_Line_Active( - const volatile struct mstp_port_struct_t *mstp_port); - - unsigned MSTP_Create_Frame( - uint8_t * buffer, /* where frame is loaded */ - unsigned buffer_len, /* amount of space available */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t * data, /* any data to be sent - may be null */ - unsigned data_len); /* number of bytes of data (up to 501) */ - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f6720/pic18f6720.tpi b/ports/pic18f6720/pic18f6720.tpi deleted file mode 100644 index d26a54b3..00000000 --- a/ports/pic18f6720/pic18f6720.tpi +++ /dev/null @@ -1,408 +0,0 @@ -PICS 0 -BACnet Protocol Implementation Conformance Statement - --- --- --- BACnet Stack Demo --- bacnet.sourceforge.net --- Author: Steve Karg --- --- -Vendor Name: "ASHRAE" -Product Name: "PIC18F6720 Device" -Product Model Number: "GNU Demo" -Product Description: "BACnet Demo" - -BIBBs Supported: -{ --- The BIBBs may be any of: --- DS-RP-A - DS-RP-B --- DS-RPM-A DS-RPM-B --- DS-RPC-A DS-RPC-B --- DS-WP-A - DS-WP-B --- DS-WPM-A DS-WPM-B --- DS-COV-A DS-COV-B --- DS-COVP-A DS-COVP-B --- DS-COVU-A DS-COVU-B --- AE-N-A AE-N-I-B AE-N-E-B --- AE-ACK-A AE-ACK-B --- AE-ASUM-A AE-ASUM-B --- AE-ESUM-A AE-ESUM-B --- AE-INFO-A AE-INFO-B --- AE-LS-A AE-LS-B --- SCHED-A SCHED-I-B SCHED-E-B --- T-VMT-A T-VMT-I-B T-VMT-E-B --- T-ATR-A T-ATR-B --- DM-DDB-A - DM-DDB-B --- DM-DOB-A --- DM-DOB-B --- DM-DCC-A - DM-DCC-B --- DM-PT-A DM-PT-B --- DM-TM-A DM-TM-B --- DM-TS-A --- DM-TS-B --- DM-UTC-A --- DM-UTC-B --- DM-RD-A - DM-RD-B --- DM-BR-A DM-BR-B --- DM-R-A DM-R-B --- DM-LM-A DM-LM-B --- DM-OCD-A DM-OCD-B --- DM-VT-A DM-VT-B --- NM-CE-A NM-CE-B --- NM-RC-A NM-RC-B -} - -BACnet Standard Application Services Supported: -{ --- AcknowledgeAlarm Initiate Execute --- ConfirmedCOVNotification Initiate Execute --- UnconfirmedCOVNotification Initiate --- ConfirmedEventNotification Initiate Execute --- UnconfirmedEventNotification Initiate Execute --- GetAlarmSummary Initiate Execute --- GetEnrollmentSummary Initiate Execute --- AtomicReadFile Initiate Execute --- AtomicWriteFile Initiate Execute --- AddListElement Initiate Execute --- RemoveListElement Initiate Execute --- CreateObject Initiate Execute --- DeleteObject Initiate Execute - ReadProperty Execute --- ReadpropertyConditional Initiate Execute --- ReadPropertyMultiple Initiate Execute --- SubscribeCOV Initiate Execute - WriteProperty Execute --- WritePropertyMultiple Initiate Execute - DeviceCommunicationControl Execute --- ConfirmedPrivateTransfer Initiate Execute --- UnconfirmedPrivateTransfer Initiate Execute --- TimeSynchronization Initiate Execute --- Who-Has Execute --- I-Have Initiate - Who-Is Execute - I-Am Initiate --- VT-Open Initiate Execute --- VT-Close Initiate Execute --- VT-Data Initiate Execute --- ConfirmedTextMessage Initiate Execute --- UnconfirmedTextMessage Initiate Execute - ReinitializeDevice Execute --- RequestKey Initiate Execute --- Authenticate Initiate Execute --- UTCTimeSynchronization Initiate Execute --- ReadRange Initiate Execute --- GetEventInformation Initiate Execute --- LifeSafetyOperation Initiate Execute --- SubscribeCOVProperty Initiate Execute --- RequestKey Initiate Execute --- Authenticate Initiate Execute -} - -Standard Object-Types Supported: -{ - Analog Input --- Analog Output - Analog Value --- Averaging Createable Deleteable - Binary Input --- Binary Output - Binary Value --- Calendar Createable Deleteable --- Command Createable Deleteable - Device --- Event Enrollment Createable Deleteable --- File --- Group Createable Deleteable --- Loop Createable Deleteable --- Multi-state Input Createable Deleteable --- Multi-state Output --- Multi-state Value Createable Deleteable --- Notification Class Createable Deleteable --- Program Createable Deleteable --- Schedule Createable Deleteable --- Life Safety Point --- Life Safety Zone Createable Deleteable --- Trend Log Createable Deleteable --- Load Control -} - -Data Link Layer Option: -{ --- ISO 8802-3, 10BASE5 --- ISO 8802-3, 10BASE2 --- ISO 8802-3, 10BASET --- ISO 8802-3, Fiber --- ARCNET, coax star --- ARCNET, coax bus --- ARCNET, twisted pair star --- ARCNET, twisted pair bus --- ARCNET, fiber star -MS/TP master. Baud rate(s): 9600, 19200, 38400, 76800 --- MS/TP slave. Baud rate(s): 9600 --- Point-To-Point. Modem, Baud rate(s): 14.4k --- Point-To-Point. Modem, Autobaud range: 9600 to 28.8k --- BACnet/IP, 'DIX' Ethernet --- BACnet/IP, PPP --- Other -} - -Character Sets Supported: -{ - ANSI X3.4 --- Other Character Sets not supported --- IBM/Microsoft DBCS --- JIS C 6226 --- ISO 10646 (ICS-4) --- ISO 10646 (UCS2) -} - -Special Functionality: -{ - Maximum APDU size in octets: 50 --- Maximum APDU size in octets: 480 --- Segmented Requests Supported, window size: 1 --- Segmented Responses Supported, window size: 1 --- Router -} - -List of Objects in test device: -{ - { - object-identifier: (device,12345) - object-name: "PIC18F6720 Device" - object-type: device - system-status: operational - vendor-name: "ASHRAE" - vendor-identifier: 0 - model-name: "GNU Demo" - firmware-revision: "1.00" - application-software-version: "1.00" - location: "USA" - description: "BACnet Demo" - protocol-version: 1 - protocol-conformance-class: 1 - protocol-services-supported: (T,F,F,F,F,F,F,F,F,F,F,F,T,F,F,T,F,T,F,F,T,F,F, -F,F,F,F,F,F,F,F,F,F,F,T,F,F,F,F,F) - protocol-object-types-supported: (T,F,T,T,F,T,F,F,T,F,F,F,F,F,F,F,F,F,F,F,F, -F,F,F,F,F,F,F,F,F,F,F) - max-apdu-length-accepted: 50 - segmentation-supported: no-segmentation - local-time: ? - local-date: ? - utc-offset: ? - daylight-savings-status: ? - database-revision: ? - apdu-timeout: 60000 - number-of-apdu-retries: 0 - max-master: 127 - max-info-frames: 1 - device-address-binding: ? - object-list: { - (device,12345),(binary-value,0),(binary-value,1), - (binary-value,2),(binary-value,3),(binary-value,4), - (binary-value,5),(binary-value,6),(binary-value,7), - (analog-value,0),(analog-value,1),(analog-value,2), - (analog-value,3),(analog-input,0),(analog-input,1), - (binary-input,0),(binary-input,1),(binary-input,2), - (binary-input,3) - } - }, - { - object-identifier: (binary-value,0) - object-name: "BV-0" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-0" - }, - { - object-identifier: (binary-value,1) - object-name: "BV-1" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-1" - }, - { - object-identifier: (binary-value,2) - object-name: "BV-2" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-2" - }, - { - object-identifier: (binary-value,3) - object-name: "BV-3" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-3" - }, - { - object-identifier: (binary-value,4) - object-name: "BV-4" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-4" - }, - { - object-identifier: (binary-value,5) - object-name: "BV-5" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-5" - }, - { - object-identifier: (binary-value,6) - object-name: "BV-6" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-6" - }, - { - object-identifier: (binary-value,7) - object-name: "BV-7" - object-type: binary-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - description: "BV-7" - }, - { - object-identifier: (analog-value,0) - object-name: "AV-0" - object-type: analog-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AV-0" - }, - { - object-identifier: (analog-value,1) - object-name: "AV-1" - object-type: analog-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AV-1" - }, - { - object-identifier: (analog-value,2) - object-name: "AV-2" - object-type: analog-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AV-2" - }, - { - object-identifier: (analog-value,3) - object-name: "AV-3" - object-type: analog-value - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AV-3" - }, - { - object-identifier: (analog-input,0) - object-name: "AI-0" - object-type: analog-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AI-0" - }, - { - object-identifier: (analog-input,1) - object-name: "AI-1" - object-type: analog-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - units: percent - description: "AI-1" - }, - { - object-identifier: (binary-input,0) - object-name: "BI-0" - object-type: binary-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - polarity: normal - description: "BI-0" - }, - { - object-identifier: (binary-input,1) - object-name: "BI-1" - object-type: binary-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - polarity: normal - description: "BI-1" - }, - { - object-identifier: (binary-input,2) - object-name: "BI-2" - object-type: binary-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - polarity: normal - description: "BI-2" - }, - { - object-identifier: (binary-input,3) - object-name: "BI-3" - object-type: binary-input - present-value: ? - status-flags: (F,F,F,F) - event-state: normal - out-of-service: F - polarity: normal - description: "BI-3" - } -} - -End of BACnet Protocol Implementation Conformance Statement diff --git a/ports/pic18f6720/readme.txt b/ports/pic18f6720/readme.txt deleted file mode 100644 index 83d95e21..00000000 --- a/ports/pic18f6720/readme.txt +++ /dev/null @@ -1,42 +0,0 @@ -BACnet Stack - SourceForge.net -Build for MPLAB IDE - -These are some settings that are important when building -the BACnet Stack using MPLAB IDE and MCC18 Compiler, - -1. Add the files to the project that you need: -abort.c, apdu.c, bacapp.c, bacdcode.c, bacerror.c, -bacstr.c, crc.c, datetime.c, dcc.c, iam.c, -npdu.c, rd.c, reject.c, rp.c, whois.c, wp.c - -From ports/picxx: isr.c, main.c, rs485.c, mstp.c, dlmstp.c - -From demo/object/: device.c or dev_tiny.c -objects as needed: ai.c, ao.c, etc. - -From demo/handler/: txbuf.c, h_dcc.c, h_rd.c, h_rp.c or h_rp_tiny.c -Additional handlers as needed: h_wp.c - -2. Project->Options->Project - -General Tab: Include Path: -C:\code\bacnet-stack\;C:\code\bacnet-stack\demo\handler\;C:\code\bacnet-stack\demo\object\;C:\code\bacnet-stack\ports\pic18f6720\ - -MPLAB C18 Tab: Memory Model: -Code: Large Code Model -Data: Large Data Model -Stack: Multi-bank Model - -MPLAB C18 Tab: General: Macro Definitions: -PRINT_ENABLED=0 -BACDL_MSTP=1 -TSM_ENABLED=0 - -3. The linker script must reserve some extra stack space. - -//DATABANK NAME=gpr12 START=0xC00 END=0xCFF -//DATABANK NAME=gpr13 START=0xD00 END=0xDFF -DATABANK NAME=stackreg START=0xC00 END=0xDFF PROTECTED - -//STACK SIZE=0x100 RAM=gpr13 -STACK SIZE=0x200 RAM=stackreg diff --git a/ports/pic18f6720/rs485.c b/ports/pic18f6720/rs485.c deleted file mode 100644 index afab7382..00000000 --- a/ports/pic18f6720/rs485.c +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* The module handles sending data out the RS-485 port */ -/* and handles receiving data from the RS-485 port. */ -/* Customize this file for your specific hardware */ -#include -#include -#include -#include -#include "hardware.h" -#include "bacnet/datalink/mstp.h" -#include "rs485.h" -#include "bacnet/basic/sys/fifo.h" - -/* public port info */ -extern volatile struct mstp_port_struct_t MSTP_Port; - -/* the baud rate is adjustable */ -uint32_t RS485_Baud_Rate = 38400; - -/* the FIFO structures for sending and receiving */ -FIFO_BUFFER FIFO_Rx; -FIFO_BUFFER FIFO_Tx; -#pragma udata MSTPPortData -/* the buffer for receiving data (size must be a power of 2) */ -volatile uint8_t RS485_Rx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)]; -/* the buffer for sending data (size must be a power of 2) */ -volatile uint8_t RS485_Tx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)]; -#pragma udata - -/**************************************************************************** - * DESCRIPTION: Transmits a frame using the UART - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port specific data */ - const uint8_t *buffer, /* frame to send (up to 501 bytes of data) */ - uint16_t nbytes) -{ /* number of bytes of data (up to 501) */ - uint16_t i = 0; /* loop counter */ - uint8_t turnaround_time; - - if (!buffer) - return; - - while (!FIFO_Empty(&FIFO_Tx)) { - /* buffer is not empty. Wait for ISR to transmit. */ - }; - - /* wait 40 bit times since reception */ - if (RS485_Baud_Rate == 9600) - turnaround_time = 4; - else if (RS485_Baud_Rate == 19200) - turnaround_time = 2; - else - turnaround_time = 2; - - while (mstp_port->SilenceTimer < turnaround_time) { - /* The line has not been silent long enough, so wait. */ - }; - - if (FIFO_Add(&FIFO_Tx, buffer, nbytes)) { - /* disable the receiver */ - PIE3bits.RC2IE = 0; - RCSTA2bits.CREN = 0; - /* enable the transceiver */ - RS485_TX_ENABLE = 1; - RS485_RX_DISABLE = 1; - /* enable the transmitter */ - TXSTA2bits.TXEN = 1; - PIE3bits.TX2IE = 1; - /* reset the silence timer per MSTP spec, sort of */ - mstp_port->SilenceTimer = 0; - } - - return; -} - -/**************************************************************************** - * DESCRIPTION: Checks for data on the receive UART, and handles errors - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -bool RS485_Check_UART_Data(volatile struct mstp_port_struct_t *mstp_port) -{ - /* check for data */ - if (!FIFO_Empty(&FIFO_Rx)) { - mstp_port->DataRegister = FIFO_Get(&FIFO_Rx); - mstp_port->DataAvailable = TRUE; - } - - return (!FIFO_Empty(&FIFO_Rx)); -} - -/* ************************************************************************* - DESCRIPTION: Receives RS485 data stream - - RETURN: none - - ALGORITHM: none - - NOTES: none - *************************************************************************** */ -void RS485_Interrupt_Rx(void) -{ - uint8_t data_byte; - - if ((RCSTA2bits.FERR) || (RCSTA2bits.OERR)) { - /* Clear the error */ - RCSTA2bits.CREN = 0; - RCSTA2bits.CREN = 1; - /* FIXME: flag the MS/TP state machine on buffer overrun */ - data_byte = RCREG2; - } else { - data_byte = RCREG2; - FIFO_Put(&FIFO_Rx, data_byte); - } -} - -/* ************************************************************************* - DESCRIPTION: Transmits a byte using the UART out the RS485 port - - RETURN: none - - ALGORITHM: none - - NOTES: none - *************************************************************************** */ -void RS485_Interrupt_Tx(void) -{ - if (!FIFO_Empty(&FIFO_Tx)) { - TXREG2 = FIFO_Get(&FIFO_Tx); - } else { - /* wait for the USART to be empty */ - while (!TXSTA2bits.TRMT) - ; - /* disable this interrupt */ - PIE3bits.TX2IE = 0; - /* enable the receiver */ - RS485_TX_ENABLE = 0; - RS485_RX_DISABLE = 0; - /* enable the this interrupt */ - PIE3bits.RC2IE = 1; - RCSTA2bits.CREN = 1; - } -} - -/**************************************************************************** - * DESCRIPTION: Returns the baud rate that we are currently running at - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -uint32_t RS485_Get_Baud_Rate(void) -{ - return RS485_Baud_Rate; -} - -/**************************************************************************** - * DESCRIPTION: Sets the baud rate for the chip USART - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -bool RS485_Set_Baud_Rate(uint32_t baud) -{ - bool valid = true; - - switch (baud) { - case 9600: - case 19200: - case 38400: - case 57600: - case 76800: - case 115200: - RS485_Baud_Rate = baud; - break; - default: - valid = false; - break; - } - - if (valid) { - /* FIXME: store the baud rate */ - /* I2C_Write_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&RS485_Baud_Rate, - sizeof(RS485_Baud_Rate), - EEPROM_MSTP_BAUD_RATE_ADDR); */ - } - - return valid; -} - -/**************************************************************************** - * DESCRIPTION: Initializes the RS485 hardware and variables, and starts in - * receive mode. - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Initialize_Port(void) -{ - /* Reset USART registers to POR state */ - TXSTA2 = 0; - RCSTA2 = 0; - /* configure USART for receiving */ - /* since the TX will handle setting up for transmit */ - RCSTA2bits.CREN = 1; - /* Interrupt on receipt */ - PIE3bits.RC2IE = 1; - /* enable the transmitter, disable its interrupt */ - TXSTA2bits.TXEN = 1; - PIE3bits.TX2IE = 0; - /* setup USART Baud Rate Generator */ - /* see BAUD RATES FOR ASYNCHRONOUS MODE in Data Book */ - /* Fosc=20MHz - BRGH=1 BRGH=0 - Rate SPBRG Rate SPBRG - ------- ----- ------- ----- - 9615 129 9469 32 - 19230 64 19530 15 - 37878 32 78130 3 - 56818 21 104200 2 - 113630 10 312500 0 - 250000 4 - 625000 1 - 1250000 0 - */ - switch (RS485_Baud_Rate) { - case 19200: - SPBRG2 = 64; - TXSTA2bits.BRGH = 1; - break; - case 38400: - SPBRG2 = 32; - TXSTA2bits.BRGH = 1; - break; - case 57600: - SPBRG2 = 21; - TXSTA2bits.BRGH = 1; - break; - case 76800: - SPBRG2 = 3; - TXSTA2bits.BRGH = 0; - break; - case 115200: - SPBRG2 = 10; - TXSTA2bits.BRGH = 1; - break; - case 9600: - SPBRG2 = 129; - TXSTA2bits.BRGH = 1; - break; - default: - SPBRG2 = 129; - TXSTA2bits.BRGH = 1; - RS485_Set_Baud_Rate(9600); - break; - } - /* select async mode */ - TXSTA2bits.SYNC = 0; - /* enable transmitter */ - TXSTA2bits.TXEN = 1; - /* serial port enable */ - RCSTA2bits.SPEN = 1; - /* since we are using RS485, - we need to explicitly say - transmit enable or not */ - RS485_RX_DISABLE = 0; - RS485_TX_ENABLE = 0; -} - -/**************************************************************************** - * DESCRIPTION: Disables the RS485 hardware - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Disable_Port(void) -{ - RCSTA2 &= 0x4F; /* Disable the receiver */ - TXSTA2bits.TXEN = 0; /* and transmitter */ - PIE3 &= 0xCF; /* Disable both interrupts */ -} - -/**************************************************************************** - * DESCRIPTION: Reinitializes the port - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Reinit(void) -{ - RS485_Set_Baud_Rate(38400); -} - -/**************************************************************************** - * DESCRIPTION: Initializes the data and the port - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Initialize(void) -{ - /* Init the Rs485 buffers */ - FIFO_Init(&FIFO_Rx, RS485_Rx_Buffer, sizeof(RS485_Rx_Buffer)); - FIFO_Init(&FIFO_Tx, RS485_Tx_Buffer, sizeof(RS485_Tx_Buffer)); - - /* FIXME: read the stored baud rate */ - /* I2C_Read_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&RS485_Baud_Rate, - sizeof(RS485_Baud_Rate), - EEPROM_MSTP_BAUD_RATE_ADDR); */ - - RS485_Initialize_Port(); -} diff --git a/ports/pic18f6720/rs485.h b/ports/pic18f6720/rs485.h deleted file mode 100644 index 37ffcf10..00000000 --- a/ports/pic18f6720/rs485.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2004 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef RS485_H -#define RS485_H - -#include -#include "bacnet/datalink/mstp.h" - -extern uint32_t RS485_Baud_Rate; - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void RS485_Reinit( - void); - void RS485_Initialize( - void); - - void RS485_Disable( - void); - - void RS485_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port specific data */ - const uint8_t * buffer, /* frame to send (up to 501 bytes of data) */ - uint16_t nbytes); /* number of bytes of data (up to 501) */ - - /* returns true if there is more data waiting */ - bool RS485_Check_UART_Data( - volatile struct mstp_port_struct_t *mstp_port); /* port specific data */ - - void RS485_Interrupt_Rx( - void); - - void RS485_Interrupt_Tx( - void); - - uint32_t RS485_Get_Baud_Rate( - void); - bool RS485_Set_Baud_Rate( - uint32_t baud); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f6720/stdbool.h b/ports/pic18f6720/stdbool.h deleted file mode 100644 index 696ffd85..00000000 --- a/ports/pic18f6720/stdbool.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STDBOOL_H -#define STDBOOL_H - -/* C99 Boolean types for compilers without C99 support */ - -#ifndef __cplusplus -typedef char _Bool; -#ifndef bool -#define bool _Bool -#endif -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif -#define __bool_true_false_are_defined 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#endif diff --git a/ports/pic18f6720/stdint.h b/ports/pic18f6720/stdint.h deleted file mode 100644 index 84e6d12f..00000000 --- a/ports/pic18f6720/stdint.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Defines the standard integer types that are used in code */ - -#ifndef STDINT_H -#define STDINT_H 1 - -#include - -typedef unsigned char uint8_t; /* 1 byte 0 to 255 */ -typedef signed char int8_t; /* 1 byte -127 to 127 */ -typedef unsigned short uint16_t; /* 2 bytes 0 to 65535 */ -typedef signed short int16_t; /* 2 bytes -32767 to 32767 */ -/*typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215 */ -typedef unsigned long uint32_t; /* 4 bytes 0 to 4294967295 */ -typedef signed long int32_t; /* 4 bytes -2147483647 to 2147483647 */ -/* typedef signed long long int64_t; */ -/* typedef unsigned long long uint64_t; */ - -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647 - 1) - -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 - -#define UINT8_MAX 0xff /* 255U */ -#define UINT16_MAX 0xffff /* 65535U */ -#define UINT32_MAX 0xffffffff /* 4294967295U */ - -#endif /* STDINT_H */ diff --git a/ports/pic18f97j60/.clang-format b/ports/pic18f97j60/.clang-format deleted file mode 100644 index 579a192a..00000000 --- a/ports/pic18f97j60/.clang-format +++ /dev/null @@ -1,7 +0,0 @@ ---- -# Disable formatting for now as there is external code. We should move external -# code to a separate directory and enable formatting for our code. -DisableFormat: true - -# DisableFormat will not disable include sorting with some versions. -SortIncludes: Never diff --git a/ports/pic18f97j60/BACnet-Server.X/Makefile b/ports/pic18f97j60/BACnet-Server.X/Makefile deleted file mode 100644 index 05a3fb1b..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -# -# There exist several targets which are by default empty and which can be -# used for execution of your targets. These targets are usually executed -# before and after some main targets. They are: -# -# .build-pre: called before 'build' target -# .build-post: called after 'build' target -# .clean-pre: called before 'clean' target -# .clean-post: called after 'clean' target -# .clobber-pre: called before 'clobber' target -# .clobber-post: called after 'clobber' target -# .all-pre: called before 'all' target -# .all-post: called after 'all' target -# .help-pre: called before 'help' target -# .help-post: called after 'help' target -# -# Targets beginning with '.' are not intended to be called on their own. -# -# Main targets can be executed directly, and they are: -# -# build build a specific configuration -# clean remove built files from a configuration -# clobber remove all built files -# all build all configurations -# help print help mesage -# -# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and -# .help-impl are implemented in nbproject/makefile-impl.mk. -# -# Available make variables: -# -# CND_BASEDIR base directory for relative paths -# CND_DISTDIR default top distribution directory (build artifacts) -# CND_BUILDDIR default top build directory (object files, ...) -# CONF name of current configuration -# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) -# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) -# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) -# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) -# CND_PACKAGE_NAME_${CONF} name of package (current configuration) -# CND_PACKAGE_PATH_${CONF} path to package (current configuration) -# -# NOCDDL - - -# Environment -MKDIR=mkdir -CP=cp -CCADMIN=CCadmin -RANLIB=ranlib - - -# build -build: .build-post - -.build-pre: -# Add your pre 'build' code here... - -.build-post: .build-impl -# Add your post 'build' code here... - - -# clean -clean: .clean-post - -.clean-pre: -# Add your pre 'clean' code here... - -.clean-post: .clean-impl -# Add your post 'clean' code here... - - -# clobber -clobber: .clobber-post - -.clobber-pre: -# Add your pre 'clobber' code here... - -.clobber-post: .clobber-impl -# Add your post 'clobber' code here... - - -# all -all: .all-post - -.all-pre: -# Add your pre 'all' code here... - -.all-post: .all-impl -# Add your post 'all' code here... - - -# help -help: .help-post - -.help-pre: -# Add your pre 'help' code here... - -.help-post: .help-impl -# Add your post 'help' code here... - - - -# include project implementation makefile -include nbproject/Makefile-impl.mk - -# include project make variables -include nbproject/Makefile-variables.mk diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-default.mk b/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-default.mk deleted file mode 100644 index 3b491990..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-default.mk +++ /dev/null @@ -1,659 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# Edit the Makefile in the project folder instead (../Makefile). Each target -# has a -pre and a -post target defined where you can add customized code. -# -# This makefile implements configuration specific macros and targets. - - -# Include project Makefile -include Makefile -# Include makefile containing local settings -ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" -include nbproject/Makefile-local-default.mk -endif - -# Environment -MKDIR=gnumkdir -p -RM=rm -f -MV=mv -CP=cp - -# Macros -CND_CONF=default -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -IMAGE_TYPE=debug -OUTPUT_SUFFIX=cof -DEBUGGABLE_SUFFIX=cof -FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -else -IMAGE_TYPE=production -OUTPUT_SUFFIX=hex -DEBUGGABLE_SUFFIX=cof -FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -endif - -# Object Directory -OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} - -# Distribution Directory -DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} - -# Object Files Quoted if spaced -OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/1386528437/abort.o ${OBJECTDIR}/_ext/1386528437/bacapp.o ${OBJECTDIR}/_ext/1386528437/bacdcode.o ${OBJECTDIR}/_ext/1386528437/bacerror.o ${OBJECTDIR}/_ext/1386528437/bacstr.o ${OBJECTDIR}/_ext/1386528437/crc.o ${OBJECTDIR}/_ext/1386528437/dcc.o ${OBJECTDIR}/_ext/1386528437/iam.o ${OBJECTDIR}/_ext/1386528437/rd.o ${OBJECTDIR}/_ext/1386528437/reject.o ${OBJECTDIR}/_ext/1386528437/rp.o ${OBJECTDIR}/_ext/1386528437/whois.o ${OBJECTDIR}/_ext/1394255507/h_dcc.o ${OBJECTDIR}/_ext/1394255507/h_rd.o ${OBJECTDIR}/_ext/1472/main.o ${OBJECTDIR}/_ext/1472/dlmstp.o ${OBJECTDIR}/_ext/1472/device.o ${OBJECTDIR}/_ext/1472/rs485.o ${OBJECTDIR}/_ext/1472/isr.o ${OBJECTDIR}/_ext/1386528437/datetime.o ${OBJECTDIR}/_ext/1394255507/txbuf.o ${OBJECTDIR}/_ext/1394255507/h_whois.o ${OBJECTDIR}/_ext/1472/mstp.o ${OBJECTDIR}/_ext/1472/bv.o ${OBJECTDIR}/_ext/1472/ai.o ${OBJECTDIR}/_ext/1472/bi.o ${OBJECTDIR}/_ext/1472/av.o ${OBJECTDIR}/_ext/1386528437/wp.o ${OBJECTDIR}/_ext/1394255507/h_npdu.o ${OBJECTDIR}/_ext/1394255507/s_iam.o ${OBJECTDIR}/_ext/1386528437/bacreal.o ${OBJECTDIR}/_ext/1386528437/bacint.o ${OBJECTDIR}/_ext/1386528437/npdu.o ${OBJECTDIR}/_ext/1472/apdu.o ${OBJECTDIR}/_ext/1394255507/noserv.o ${OBJECTDIR}/_ext/1386528437/fifo.o ${OBJECTDIR}/_ext/1394255507/h_rp.o ${OBJECTDIR}/_ext/1394255507/h_wp.o ${OBJECTDIR}/_ext/1386528437/bacaddr.o -POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/1386528437/abort.o.d ${OBJECTDIR}/_ext/1386528437/bacapp.o.d ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d ${OBJECTDIR}/_ext/1386528437/bacerror.o.d ${OBJECTDIR}/_ext/1386528437/bacstr.o.d ${OBJECTDIR}/_ext/1386528437/crc.o.d ${OBJECTDIR}/_ext/1386528437/dcc.o.d ${OBJECTDIR}/_ext/1386528437/iam.o.d ${OBJECTDIR}/_ext/1386528437/rd.o.d ${OBJECTDIR}/_ext/1386528437/reject.o.d ${OBJECTDIR}/_ext/1386528437/rp.o.d ${OBJECTDIR}/_ext/1386528437/whois.o.d ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d ${OBJECTDIR}/_ext/1394255507/h_rd.o.d ${OBJECTDIR}/_ext/1472/main.o.d ${OBJECTDIR}/_ext/1472/dlmstp.o.d ${OBJECTDIR}/_ext/1472/device.o.d ${OBJECTDIR}/_ext/1472/rs485.o.d ${OBJECTDIR}/_ext/1472/isr.o.d ${OBJECTDIR}/_ext/1386528437/datetime.o.d ${OBJECTDIR}/_ext/1394255507/txbuf.o.d ${OBJECTDIR}/_ext/1394255507/h_whois.o.d ${OBJECTDIR}/_ext/1472/mstp.o.d ${OBJECTDIR}/_ext/1472/bv.o.d ${OBJECTDIR}/_ext/1472/ai.o.d ${OBJECTDIR}/_ext/1472/bi.o.d ${OBJECTDIR}/_ext/1472/av.o.d ${OBJECTDIR}/_ext/1386528437/wp.o.d ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d ${OBJECTDIR}/_ext/1394255507/s_iam.o.d ${OBJECTDIR}/_ext/1386528437/bacreal.o.d ${OBJECTDIR}/_ext/1386528437/bacint.o.d ${OBJECTDIR}/_ext/1386528437/npdu.o.d ${OBJECTDIR}/_ext/1472/apdu.o.d ${OBJECTDIR}/_ext/1394255507/noserv.o.d ${OBJECTDIR}/_ext/1386528437/fifo.o.d ${OBJECTDIR}/_ext/1394255507/h_rp.o.d ${OBJECTDIR}/_ext/1394255507/h_wp.o.d ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - -# Object Files -OBJECTFILES=${OBJECTDIR}/_ext/1386528437/abort.o ${OBJECTDIR}/_ext/1386528437/bacapp.o ${OBJECTDIR}/_ext/1386528437/bacdcode.o ${OBJECTDIR}/_ext/1386528437/bacerror.o ${OBJECTDIR}/_ext/1386528437/bacstr.o ${OBJECTDIR}/_ext/1386528437/crc.o ${OBJECTDIR}/_ext/1386528437/dcc.o ${OBJECTDIR}/_ext/1386528437/iam.o ${OBJECTDIR}/_ext/1386528437/rd.o ${OBJECTDIR}/_ext/1386528437/reject.o ${OBJECTDIR}/_ext/1386528437/rp.o ${OBJECTDIR}/_ext/1386528437/whois.o ${OBJECTDIR}/_ext/1394255507/h_dcc.o ${OBJECTDIR}/_ext/1394255507/h_rd.o ${OBJECTDIR}/_ext/1472/main.o ${OBJECTDIR}/_ext/1472/dlmstp.o ${OBJECTDIR}/_ext/1472/device.o ${OBJECTDIR}/_ext/1472/rs485.o ${OBJECTDIR}/_ext/1472/isr.o ${OBJECTDIR}/_ext/1386528437/datetime.o ${OBJECTDIR}/_ext/1394255507/txbuf.o ${OBJECTDIR}/_ext/1394255507/h_whois.o ${OBJECTDIR}/_ext/1472/mstp.o ${OBJECTDIR}/_ext/1472/bv.o ${OBJECTDIR}/_ext/1472/ai.o ${OBJECTDIR}/_ext/1472/bi.o ${OBJECTDIR}/_ext/1472/av.o ${OBJECTDIR}/_ext/1386528437/wp.o ${OBJECTDIR}/_ext/1394255507/h_npdu.o ${OBJECTDIR}/_ext/1394255507/s_iam.o ${OBJECTDIR}/_ext/1386528437/bacreal.o ${OBJECTDIR}/_ext/1386528437/bacint.o ${OBJECTDIR}/_ext/1386528437/npdu.o ${OBJECTDIR}/_ext/1472/apdu.o ${OBJECTDIR}/_ext/1394255507/noserv.o ${OBJECTDIR}/_ext/1386528437/fifo.o ${OBJECTDIR}/_ext/1394255507/h_rp.o ${OBJECTDIR}/_ext/1394255507/h_wp.o ${OBJECTDIR}/_ext/1386528437/bacaddr.o - - -CFLAGS= -ASFLAGS= -LDLIBSOPTIONS= - -############# Tool locations ########################################## -# If you copy a project from one host to another, the path where the # -# compiler is installed may be different. # -# If you open this project with MPLAB X in the new host, this # -# makefile will be regenerated and the paths will be corrected. # -####################################################################### -# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build -FIXDEPS=fixDeps - -.build-conf: ${BUILD_SUBPROJECTS} - ${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} - -MP_PROCESSOR_OPTION=18F97J60 -MP_PROCESSOR_OPTION_LD=18f97j60 -MP_LINKER_DEBUG_OPTION= -# ------------------------------------------------------------------------------------ -# Rules for buildStep: assemble -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -else -endif - -# ------------------------------------------------------------------------------------ -# Rules for buildStep: compile -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -${OBJECTDIR}/_ext/1386528437/abort.o: ../../../src/abort.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/abort.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/abort.o ../../../src/abort.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/abort.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/abort.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacapp.o: ../../../src/bacapp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacapp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacapp.o ../../../src/bacapp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacapp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacapp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacdcode.o: ../../../src/bacdcode.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacdcode.o ../../../src/bacdcode.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacdcode.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacdcode.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacerror.o: ../../../src/bacerror.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacerror.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacerror.o ../../../src/bacerror.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacerror.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacerror.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacstr.o: ../../../src/bacstr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacstr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacstr.o ../../../src/bacstr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacstr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacstr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/crc.o: ../../../src/crc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/crc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/crc.o ../../../src/crc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/crc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/crc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/dcc.o: ../../../src/dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/dcc.o ../../../src/dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/iam.o: ../../../src/iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/iam.o ../../../src/iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rd.o: ../../../src/rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rd.o ../../../src/rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/reject.o: ../../../src/reject.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/reject.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/reject.o ../../../src/reject.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/reject.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/reject.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rp.o: ../../../src/rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rp.o ../../../src/rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/whois.o: ../../../src/whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/whois.o ../../../src/whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_dcc.o: ../../../demo/handler/h_dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_dcc.o ../../../demo/handler/h_dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rd.o: ../../../demo/handler/h_rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rd.o ../../../demo/handler/h_rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/main.o: ../main.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/main.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/main.o ../main.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/main.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/dlmstp.o: ../dlmstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/dlmstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/dlmstp.o ../dlmstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/dlmstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/dlmstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/device.o: ../device.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/device.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/device.o ../device.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/device.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/device.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/rs485.o: ../rs485.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/rs485.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/rs485.o ../rs485.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/rs485.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/rs485.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/isr.o: ../isr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/isr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/isr.o ../isr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/isr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/isr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/datetime.o: ../../../src/datetime.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/datetime.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/datetime.o ../../../src/datetime.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/datetime.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/datetime.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/txbuf.o: ../../../demo/handler/txbuf.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/txbuf.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/txbuf.o ../../../demo/handler/txbuf.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/txbuf.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/txbuf.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_whois.o: ../../../demo/handler/h_whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_whois.o ../../../demo/handler/h_whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/mstp.o: ../mstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/mstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/mstp.o ../mstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/mstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/mstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bv.o: ../bv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bv.o ../bv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/ai.o: ../ai.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/ai.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/ai.o ../ai.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/ai.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/ai.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bi.o: ../bi.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bi.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bi.o ../bi.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bi.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bi.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/av.o: ../av.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/av.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/av.o ../av.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/av.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/av.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/wp.o: ../../../src/wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/wp.o ../../../src/wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_npdu.o: ../../../demo/handler/h_npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_npdu.o ../../../demo/handler/h_npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/s_iam.o: ../../../demo/handler/s_iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/s_iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/s_iam.o ../../../demo/handler/s_iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/s_iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/s_iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacreal.o: ../../../src/bacreal.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacreal.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacreal.o ../../../src/bacreal.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacreal.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacreal.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacint.o: ../../../src/bacint.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacint.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacint.o ../../../src/bacint.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacint.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacint.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/npdu.o: ../../../src/npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/npdu.o ../../../src/npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/apdu.o: ../apdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/apdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/apdu.o ../apdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/apdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/apdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/noserv.o: ../../../demo/handler/noserv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/noserv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/noserv.o ../../../demo/handler/noserv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/noserv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/noserv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/fifo.o: ../../../src/fifo.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/fifo.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/fifo.o ../../../src/fifo.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/fifo.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/fifo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rp.o: ../../../demo/handler/h_rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rp.o ../../../demo/handler/h_rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_wp.o: ../../../demo/handler/h_wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_wp.o ../../../demo/handler/h_wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacaddr.o: ../../../src/bacaddr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacaddr.o ../../../src/bacaddr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacaddr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacaddr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -else -${OBJECTDIR}/_ext/1386528437/abort.o: ../../../src/abort.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/abort.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/abort.o ../../../src/abort.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/abort.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/abort.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacapp.o: ../../../src/bacapp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacapp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacapp.o ../../../src/bacapp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacapp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacapp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacdcode.o: ../../../src/bacdcode.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacdcode.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacdcode.o ../../../src/bacdcode.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacdcode.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacdcode.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacerror.o: ../../../src/bacerror.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacerror.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacerror.o ../../../src/bacerror.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacerror.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacerror.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacstr.o: ../../../src/bacstr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacstr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacstr.o ../../../src/bacstr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacstr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacstr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/crc.o: ../../../src/crc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/crc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/crc.o ../../../src/crc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/crc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/crc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/dcc.o: ../../../src/dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/dcc.o ../../../src/dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/iam.o: ../../../src/iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/iam.o ../../../src/iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rd.o: ../../../src/rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rd.o ../../../src/rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/reject.o: ../../../src/reject.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/reject.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/reject.o ../../../src/reject.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/reject.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/reject.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/rp.o: ../../../src/rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/rp.o ../../../src/rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/whois.o: ../../../src/whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/whois.o ../../../src/whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_dcc.o: ../../../demo/handler/h_dcc.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_dcc.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_dcc.o ../../../demo/handler/h_dcc.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_dcc.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_dcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rd.o: ../../../demo/handler/h_rd.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rd.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rd.o ../../../demo/handler/h_rd.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rd.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rd.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/main.o: ../main.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/main.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/main.o ../main.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/main.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/dlmstp.o: ../dlmstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/dlmstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/dlmstp.o ../dlmstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/dlmstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/dlmstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/device.o: ../device.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/device.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/device.o ../device.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/device.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/device.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/rs485.o: ../rs485.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/rs485.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/rs485.o ../rs485.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/rs485.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/rs485.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/isr.o: ../isr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/isr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/isr.o ../isr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/isr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/isr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/datetime.o: ../../../src/datetime.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/datetime.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/datetime.o ../../../src/datetime.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/datetime.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/datetime.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/txbuf.o: ../../../demo/handler/txbuf.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/txbuf.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/txbuf.o ../../../demo/handler/txbuf.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/txbuf.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/txbuf.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_whois.o: ../../../demo/handler/h_whois.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_whois.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_whois.o ../../../demo/handler/h_whois.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_whois.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_whois.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/mstp.o: ../mstp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/mstp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/mstp.o ../mstp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/mstp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/mstp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bv.o: ../bv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bv.o ../bv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/ai.o: ../ai.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/ai.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/ai.o ../ai.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/ai.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/ai.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/bi.o: ../bi.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/bi.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/bi.o ../bi.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/bi.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/bi.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/av.o: ../av.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/av.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/av.o ../av.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/av.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/av.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/wp.o: ../../../src/wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/wp.o ../../../src/wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_npdu.o: ../../../demo/handler/h_npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_npdu.o ../../../demo/handler/h_npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/s_iam.o: ../../../demo/handler/s_iam.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/s_iam.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/s_iam.o ../../../demo/handler/s_iam.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/s_iam.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/s_iam.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacreal.o: ../../../src/bacreal.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacreal.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacreal.o ../../../src/bacreal.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacreal.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacreal.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacint.o: ../../../src/bacint.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacint.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacint.o ../../../src/bacint.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacint.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacint.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/npdu.o: ../../../src/npdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/npdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/npdu.o ../../../src/npdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/npdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/npdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1472/apdu.o: ../apdu.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1472 - @${RM} ${OBJECTDIR}/_ext/1472/apdu.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1472/apdu.o ../apdu.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1472/apdu.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1472/apdu.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/noserv.o: ../../../demo/handler/noserv.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/noserv.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/noserv.o ../../../demo/handler/noserv.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/noserv.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/noserv.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/fifo.o: ../../../src/fifo.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/fifo.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/fifo.o ../../../src/fifo.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/fifo.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/fifo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_rp.o: ../../../demo/handler/h_rp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_rp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_rp.o ../../../demo/handler/h_rp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_rp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_rp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1394255507/h_wp.o: ../../../demo/handler/h_wp.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1394255507 - @${RM} ${OBJECTDIR}/_ext/1394255507/h_wp.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1394255507/h_wp.o ../../../demo/handler/h_wp.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1394255507/h_wp.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1394255507/h_wp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -${OBJECTDIR}/_ext/1386528437/bacaddr.o: ../../../src/bacaddr.c nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} ${OBJECTDIR}/_ext/1386528437 - @${RM} ${OBJECTDIR}/_ext/1386528437/bacaddr.o.d - ${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -DPRINT_ENABLED=0 -DBACDL_MSTP=1 -DBIG_ENDIAN=0 -DMAX_APDU=50 -DMAX_TSM_TRANSACTIONS=0 -DBACAPP_MINIMAL -I"../" -I"../../../include" -I"../../../demo/object" -ml -oa- -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/_ext/1386528437/bacaddr.o ../../../src/bacaddr.c - @${DEP_GEN} -d ${OBJECTDIR}/_ext/1386528437/bacaddr.o - @${FIXDEPS} "${OBJECTDIR}/_ext/1386528437/bacaddr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c18 - -endif - -# ------------------------------------------------------------------------------------ -# Rules for buildStep: link -ifeq ($(TYPE_IMAGE), DEBUG_RUN) -dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION_LD) -w -x -u_DEBUG -z__MPLAB_BUILD=1 -u_CRUNTIME -z__MPLAB_DEBUG=1 -z__MPLAB_DEBUGGER_ICD3=1 $(MP_LINKER_DEBUG_OPTION) -l ${MP_CC_DIR}\\..\\lib -o dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -else -dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION_LD) -w -z__MPLAB_BUILD=1 -u_CRUNTIME -l ${MP_CC_DIR}\\..\\lib -o dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -endif - - -# Subprojects -.build-subprojects: - - -# Subprojects -.clean-subprojects: - -# Clean Targets -.clean-conf: ${CLEAN_SUBPROJECTS} - ${RM} -r build/default - ${RM} -r dist/default - -# Enable dependency checking -.dep.inc: .depcheck-impl - -DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) -ifneq (${DEPFILES},) -include ${DEPFILES} -endif diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-genesis.properties b/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-genesis.properties deleted file mode 100644 index c635b02f..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-genesis.properties +++ /dev/null @@ -1,8 +0,0 @@ -# -#Mon May 30 09:28:30 CDT 2016 -default.com-microchip-mplab-nbide-toolchainC18-C18LanguageToolchain.md5=21ae92f54c0f89bc027339aedc19b7f9 -default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\mplabc18\\v3.40\\bin -com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=ef199adcc8f049579a105cca20571dcb -default.languagetoolchain.version=3.40 -host.platform=windows -conf.ids=default diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-impl.mk b/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-impl.mk deleted file mode 100644 index cfa87f01..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-impl.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# Edit the Makefile in the project folder instead (../Makefile). Each target -# has a pre- and a post- target defined where you can add customization code. -# -# This makefile implements macros and targets common to all configurations. -# -# NOCDDL - - -# Building and Cleaning subprojects are done by default, but can be controlled with the SUB -# macro. If SUB=no, subprojects will not be built or cleaned. The following macro -# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf -# and .clean-reqprojects-conf unless SUB has the value 'no' -SUB_no=NO -SUBPROJECTS=${SUB_${SUB}} -BUILD_SUBPROJECTS_=.build-subprojects -BUILD_SUBPROJECTS_NO= -BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} -CLEAN_SUBPROJECTS_=.clean-subprojects -CLEAN_SUBPROJECTS_NO= -CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} - - -# Project Name -PROJECTNAME=BACnet-Server.X - -# Active Configuration -DEFAULTCONF=default -CONF=${DEFAULTCONF} - -# All Configurations -ALLCONFS=default - - -# build -.build-impl: .build-pre - ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf - - -# clean -.clean-impl: .clean-pre - ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf - -# clobber -.clobber-impl: .clobber-pre .depcheck-impl - ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean - - - -# all -.all-impl: .all-pre .depcheck-impl - ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build - - - -# dependency checking support -.depcheck-impl: -# @echo "# This code depends on make tool being used" >.dep.inc -# @if [ -n "${MAKE_VERSION}" ]; then \ -# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ -# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ -# echo "include \$${DEPFILES}" >>.dep.inc; \ -# echo "endif" >>.dep.inc; \ -# else \ -# echo ".KEEP_STATE:" >>.dep.inc; \ -# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ -# fi diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-local-default.mk b/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-local-default.mk deleted file mode 100644 index 715a50f6..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-local-default.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Generated Makefile - do not edit! -# -# -# This file contains information about the location of compilers and other tools. -# If you commmit this file into your revision control server, you will be able to -# to checkout the project and build it from the command line with make. However, -# if more than one person works on the same project, then this file might show -# conflicts since different users are bound to have compilers in different places. -# In that case you might choose to not commit this file and let MPLAB X recreate this file -# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at -# least once so the file gets created and the project can be built. Finally, you can also -# avoid using this file at all if you are only building from the command line with make. -# You can invoke make with the values of the macros: -# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... -# -SHELL=cmd.exe -PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/ -# Adding MPLAB X bin directory to path. -PATH:=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/:$(PATH) -# Path to java used to run MPLAB X when this makefile was created -MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.6.0_32-windows-x64\java-windows/bin/" -OS_CURRENT="$(shell uname -s)" -MP_CC="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mcc18.exe" -# MP_CPPC is not defined -# MP_BC is not defined -MP_AS="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm\MPASMWIN.exe" -MP_LD="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplink.exe" -MP_AR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplib.exe" -DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" -MP_CC_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -# MP_CPPC_DIR is not defined -# MP_BC_DIR is not defined -MP_AS_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm" -MP_LD_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -MP_AR_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" -# MP_BC_DIR is not defined diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-variables.mk b/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-variables.mk deleted file mode 100644 index 204009b0..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Makefile-variables.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Generated - do not edit! -# -# NOCDDL -# -CND_BASEDIR=`pwd` -# default configuration -CND_ARTIFACT_DIR_default=dist/default/production -CND_ARTIFACT_NAME_default=BACnet-Server.X.production.hex -CND_ARTIFACT_PATH_default=dist/default/production/BACnet-Server.X.production.hex -CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package -CND_PACKAGE_NAME_default=bacnet-server.x.tar -CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/bacnet-server.x.tar diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/Package-default.bash b/ports/pic18f97j60/BACnet-Server.X/nbproject/Package-default.bash deleted file mode 100755 index fe987452..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/Package-default.bash +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -x - -# -# Generated - do not edit! -# - -# Macros -TOP=`pwd` -CND_CONF=default -CND_DISTDIR=dist -TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging -TMPDIRNAME=tmp-packaging -OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -OUTPUT_BASENAME=BACnet-Server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} -PACKAGE_TOP_DIR=bacnet-server.x/ - -# Functions -function checkReturnCode -{ - rc=$? - if [ $rc != 0 ] - then - exit $rc - fi -} -function makeDirectory -# $1 directory path -# $2 permission (optional) -{ - mkdir -p "$1" - checkReturnCode - if [ "$2" != "" ] - then - chmod $2 "$1" - checkReturnCode - fi -} -function copyFileToTmpDir -# $1 from-file path -# $2 to-file path -# $3 permission -{ - cp "$1" "$2" - checkReturnCode - if [ "$3" != "" ] - then - chmod $3 "$2" - checkReturnCode - fi -} - -# Setup -cd "${TOP}" -mkdir -p ${CND_DISTDIR}/${CND_CONF}/package -rm -rf ${TMPDIR} -mkdir -p ${TMPDIR} - -# Copy files and create directories and links -cd "${TOP}" -makeDirectory ${TMPDIR}/bacnet-server.x/bin -copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 - - -# Generate tar file -cd "${TOP}" -rm -f ${CND_DISTDIR}/${CND_CONF}/package/bacnet-server.x.tar -cd ${TMPDIR} -tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/bacnet-server.x.tar * -checkReturnCode - -# Cleanup -cd "${TOP}" -rm -rf ${TMPDIR} diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/configurations.xml b/ports/pic18f97j60/BACnet-Server.X/nbproject/configurations.xml deleted file mode 100644 index aadc5fad..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/configurations.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - ../stdbool.h - ../stdint.h - ../rs485.h - ../mstp.h - ../../../include/bits.h - ../../../include/abort.h - ../../../include/apdu.h - ../../../include/bacaddr.h - ../../../include/bacapp.h - ../../../include/bacdcode.h - ../../../include/bacdef.h - ../../../include/bacenum.h - ../../../include/bacerror.h - ../../../include/bacint.h - ../../../include/bacprop.h - ../../../include/bacreal.h - ../../../include/bacstr.h - ../../../include/bigend.h - ../../../include/config.h - ../hardware.h - - - - - ../../../src/abort.c - ../../../src/bacapp.c - ../../../src/bacdcode.c - ../../../src/bacerror.c - ../../../src/bacstr.c - ../../../src/crc.c - ../../../src/dcc.c - ../../../src/iam.c - ../../../src/rd.c - ../../../src/reject.c - ../../../src/rp.c - ../../../src/whois.c - ../../../demo/handler/h_dcc.c - ../../../demo/handler/h_rd.c - ../main.c - ../dlmstp.c - ../device.c - ../rs485.c - ../isr.c - ../../../src/datetime.c - ../../../demo/handler/txbuf.c - ../../../demo/handler/h_whois.c - ../mstp.c - ../bv.c - ../ai.c - ../bi.c - ../av.c - ../../../src/wp.c - ../../../demo/handler/h_npdu.c - ../../../demo/handler/s_iam.c - ../../../src/bacreal.c - ../../../src/bacint.c - ../../../src/npdu.c - ../apdu.c - ../../../demo/handler/noserv.c - ../../../src/fifo.c - ../../../demo/handler/h_rp.c - ../../../demo/handler/h_wp.c - ../../../src/bacaddr.c - - - Makefile - - - - ../ - - Makefile - - - - localhost - PIC18F97J60 - - - ICD3PlatformTool - C18 - - 3 - - - - - - - - false - - - - - false - - false - - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/private/configurations.xml b/ports/pic18f97j60/BACnet-Server.X/nbproject/private/configurations.xml deleted file mode 100644 index 1102937f..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/private/configurations.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - Makefile - 0 - - - - - - place holder 1 - place holder 2 - - - - - true - 0 - 0 - 0 - - - - - - diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/private/private.xml b/ports/pic18f97j60/BACnet-Server.X/nbproject/private/private.xml deleted file mode 100644 index b1a89dfe..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/private/private.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - file:/D:/code/bacnet-stack/ports/pic18f97j60/main.c - file:/D:/code/bacnet-stack/ports/pic18f97j60/isr.c - file:/D:/code/bacnet-stack/ports/pic18f97j60/rs485.h - file:/D:/code/bacnet-stack/ports/pic18f97j60/rs485.c - file:/D:/code/bacnet-stack/ports/pic18f97j60/hardware.h - - diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/project.properties b/ports/pic18f97j60/BACnet-Server.X/nbproject/project.properties deleted file mode 100644 index e69de29b..00000000 diff --git a/ports/pic18f97j60/BACnet-Server.X/nbproject/project.xml b/ports/pic18f97j60/BACnet-Server.X/nbproject/project.xml deleted file mode 100644 index b7fe3eff..00000000 --- a/ports/pic18f97j60/BACnet-Server.X/nbproject/project.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - com.microchip.mplab.nbide.embedded.makeproject - - - BACnet-Server - e54ca906-513b-4f74-a23b-6b0204c4509a - 0 - c - - h - ISO-8859-1 - - - - diff --git a/ports/pic18f97j60/Makefile b/ports/pic18f97j60/Makefile deleted file mode 100644 index 672e7b36..00000000 --- a/ports/pic18f97j60/Makefile +++ /dev/null @@ -1,145 +0,0 @@ -############################################################################### -# Makefile for BACnet -############################################################################### - -## General Flags -MCU = pic18 -PORT = 18f6720 -TARGET = bacnet -## Tools -CC = sdcc -PACK = packihx - -# Source locations -BACNET_CORE = ../../src -BACNET_INCLUDE = ../../include -BACNET_DEMO = ../../demo - -CSRC = main.c \ - isr.c \ - rs485.c \ - dlmstp.c \ - mstp.c \ - $(BACNET_CORE)/crc.c - -DEMOSRC = h_rp.c \ - device.c \ - ai.c \ - av.c \ - bi.c \ - bv.c \ - $(BACNET_DEMO)/handler/txbuf.c \ - $(BACNET_DEMO)/handler/noserv.c \ - $(BACNET_DEMO)/handler/h_npdu.c \ - $(BACNET_DEMO)/handler/h_whois.c \ - h_wp.c - -CORESRC = \ - $(BACNET_CORE)/apdu.c \ - $(BACNET_CORE)/npdu.c \ - $(BACNET_CORE)/bacdcode.c \ - $(BACNET_CORE)/bacint.c \ - $(BACNET_CORE)/bacreal.c \ - $(BACNET_CORE)/bacstr.c \ - $(BACNET_CORE)/iam.c \ - $(BACNET_CORE)/rp.c \ - $(BACNET_CORE)/wp.c \ - $(BACNET_CORE)/whois.c \ - $(BACNET_CORE)/bacaddr.c \ - $(BACNET_CORE)/abort.c \ - $(BACNET_CORE)/reject.c \ - $(BACNET_CORE)/bacerror.c \ - $(BACNET_CORE)/bacapp.c \ - $(BACNET_CORE)/version.c - -## Include Directories -INCLUDES = -I. -I$(BACNET_INCLUDE) - -# Source to Object conversion -COBJ = $(CSRC:.c=.o) -DEMOOBJ = $(DEMOSRC:.c=.o) -COREOBJ = $(CORESRC:.c=.o) - -LIBRARY = lib$(TARGET).a - -## Options common to compile, link and assembly rules -COMMON = -m$(MCU) -p$(PORT) -OPTIMIZATION = --opt-code-size - -## Compile options common for all C compilation units. -BFLAGS = -DBACDL_MSTP -BFLAGS += -DMAX_APDU=128 -BFLAGS += -DBIG_ENDIAN=0 -BFLAGS += -DMAX_TSM_TRANSACTIONS=0 -#BFLAGS += -DCRC_USE_TABLE -BFLAGS += -DBACAPP_REAL -CFLAGS = $(COMMON) -# dead code removal -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -Wall $(BFLAGS) $(OPTIMIZATION) -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d - -## Assembly specific flags -ASMFLAGS = $(COMMON) -ASMFLAGS += $(CFLAGS) -ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 - -## Linker flags -LDFLAGS = $(COMMON) -#dead code removal -LDFLAGS += -Wl,--gc-sections,-static -LDFLAGS += -Wl,-Map=$(TARGET).map,-L.,-l$(TARGET) -#LDFLAGS += -Wl,-Map=$(TARGET).map - -## Intel Hex file production flags -HEX_FLASH_FLAGS = -R .eeprom -HEX_EEPROM_FLAGS = -j .eeprom -HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" -HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings - -## Objects that must be built in order to link -OBJECTS = $(COBJ) $(DEMOOBJ) -#OBJECTS = $(COBJ) - -## Build -TARGET_ELF=$(TARGET).elf - -all: $(LIBRARY) $(TARGET_ELF) $(TARGET).hex $(TARGET).eep $(TARGET).lst \ - size Makefile - -##Link -$(TARGET_ELF): $(OBJECTS) $(LIBRARY) - $(CC) $(OBJECTS) $(LDFLAGS) -o $@ - -%.hex: $(TARGET_ELF) - $(OBJCOPY) -O ihex $(HEX_FLASH_FLAGS) $< $@ - -%.eep: $(TARGET_ELF) - -$(OBJCOPY) $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 - -%.lst: $(TARGET_ELF) - $(OBJDUMP) -h -S $< > $@ - -lib: $(LIBRARY) - -$(LIBRARY): $(COREOBJ) Makefile - $(AR) rcs $@ $(COREOBJ) - $(OBJDUMP) --syms $@ > $(LIBRARY:.a=.lst) - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $*.c -o $@ - -size: ${TARGET_ELF} - @echo - @${SIZE} -C --mcu=${MCU} ${TARGET_ELF} - -## Clean target -.PHONY: clean -clean: - touch Makefile - -rm -rf $(OBJECTS) $(TARGET_ELF) dep/* - -rm -rf $(LIBRARY) $(COREOBJ) $(LIBRARY:.a=.lst) - -rm -rf $(TARGET).hex $(TARGET).eep $(TARGET).lst $(TARGET).map - -## Other dependencies --include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) diff --git a/ports/pic18f97j60/ai.c b/ports/pic18f97j60/ai.c deleted file mode 100644 index 966f04ab..00000000 --- a/ports/pic18f97j60/ai.c +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Analog Input Objects customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/ai.h" - -/* Analog Input = Photocell */ -#define MAX_ANALOG_INPUTS 2 - -static uint8_t Present_Value[MAX_ANALOG_INPUTS]; - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need validate that the */ -/* given instance exists */ -bool Analog_Input_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_ANALOG_INPUTS) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Analog_Input_Count(void) -{ - return MAX_ANALOG_INPUTS; -} - -/* we simply have 0-n object instances. */ -uint32_t Analog_Input_Index_To_Instance(unsigned index) -{ - return index; -} - -char *Analog_Input_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_ANALOG_INPUTS) { - snprintf(text, sizeof(text), "AI-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -float Analog_Input_Present_Value(uint32_t object_instance) -{ - float value = 0.0; - - if (object_instance < MAX_ANALOG_INPUTS) - value = Present_Value[object_instance]; - - return value; -} - -void Analog_Input_Present_Value_Set(uint32_t object_instance, float value) -{ - if (object_instance < MAX_ANALOG_INPUTS) { - Present_Value[object_instance] = value; - } -} - -/* return apdu length, or -1 on error */ -/* assumption - object has already exists */ -int Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - uint8_t *apdu = NULL; - - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_ANALOG_INPUT, rpdata->object_instance); - break; - /* note: Name and Description don't have to be the same. - You could make Description writable and different */ - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Analog_Input_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT); - break; - case PROP_PRESENT_VALUE: - apdu_len = encode_application_real( - &apdu[0], Analog_Input_Present_Value(rpdata->object_instance)); - break; - case PROP_STATUS_FLAGS: - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_UNITS: - apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} diff --git a/ports/pic18f97j60/apdu.c b/ports/pic18f97j60/apdu.c deleted file mode 100644 index 23065bcd..00000000 --- a/ports/pic18f97j60/apdu.c +++ /dev/null @@ -1,207 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include -#include -#include -/* BACnet Stack defines - first */ -#include "bacnet/bacdef.h" -/* BACnet Stack API */ -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/dcc.h" -#include "bacnet/basic/services.h" -/* me */ -#include "bacnet/apdu.h" - -uint16_t apdu_timeout(void) -{ - return 3000; -} - -uint8_t apdu_retries(void) -{ - return 3; -} - -bool apdu_service_supported(BACNET_SERVICES_SUPPORTED service_supported) -{ - bool status = false; - - switch (service_supported) { - case SERVICE_SUPPORTED_READ_PROPERTY: - case SERVICE_SUPPORTED_WHO_IS: - case SERVICE_CONFIRMED_REINITIALIZE_DEVICE: - case SERVICE_SUPPORTED_WRITE_PROPERTY: - case SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL: - status = true; - break; - default: - break; - } - - return status; -} - -uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */ - uint16_t apdu_len, - BACNET_CONFIRMED_SERVICE_DATA *service_data, - uint8_t *service_choice, - uint8_t **service_request, - uint16_t *service_request_len) -{ - uint16_t len = 0; /* counts where we are in PDU */ - - service_data->segmented_message = (apdu[0] & BIT(3)) ? true : false; - service_data->more_follows = (apdu[0] & BIT(2)) ? true : false; - service_data->segmented_response_accepted = - (apdu[0] & BIT(1)) ? true : false; - service_data->max_segs = decode_max_segs(apdu[1]); - service_data->max_resp = decode_max_apdu(apdu[1]); - service_data->invoke_id = apdu[2]; - len = 3; - if (service_data->segmented_message) { - service_data->sequence_number = apdu[len++]; - service_data->proposed_window_number = apdu[len++]; - } - *service_choice = apdu[len++]; - *service_request = &apdu[len]; - *service_request_len = apdu_len - len; - - return len; -} - -/* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice APDUs - shall be processed and no messages shall be initiated. - When the initiation of communications is disabled, - all APDUs shall be processed and responses returned as - required... */ -static bool apdu_confirmed_dcc_disabled(uint8_t service_choice) -{ - bool status = false; - - if (dcc_communication_disabled()) { - switch (service_choice) { - case SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL: - case SERVICE_CONFIRMED_REINITIALIZE_DEVICE: - break; - default: - status = true; - break; - } - } - - return status; -} - -/* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice APDUs - shall be processed and no messages shall be initiated. */ -/* If the request is valid and the 'Enable/Disable' parameter is - DISABLE_INITIATION, the responding BACnet-user shall - discontinue the initiation of messages except for I-Am - requests issued in accordance with the Who-Is service procedure.*/ -static bool apdu_unconfirmed_dcc_disabled(uint8_t service_choice) -{ - bool status = false; - - if (dcc_communication_disabled()) { - /* there are no Unconfirmed messages that - can be processed in this state */ - status = true; - } else if (dcc_communication_initiation_disabled()) { - /* WhoIs will be processed and I-Am initiated as response. */ - switch (service_choice) { - case SERVICE_UNCONFIRMED_WHO_IS: - case SERVICE_UNCONFIRMED_WHO_HAS: - break; - default: - status = true; - break; - } - } - - return status; -} - -void apdu_handler(BACNET_ADDRESS *src, - uint8_t *apdu, /* APDU data */ - uint16_t apdu_len) -{ - BACNET_CONFIRMED_SERVICE_DATA service_data = { 0 }; - uint8_t service_choice = 0; - uint8_t *service_request = NULL; - uint16_t service_request_len = 0; - uint16_t len = 0; /* counts where we are in PDU */ - - if (apdu) { - /* PDU Type */ - switch (apdu[0] & 0xF0) { - case PDU_TYPE_CONFIRMED_SERVICE_REQUEST: - len = apdu_decode_confirmed_service_request( - &apdu[0], /* APDU data */ - apdu_len, &service_data, &service_choice, &service_request, - &service_request_len); - if (len == 0) { - /* service data unable to be decoded - simply drop */ - break; - } - if (apdu_confirmed_dcc_disabled(service_choice)) { - /* When network communications are completely disabled, - only DeviceCommunicationControl and ReinitializeDevice - APDUs shall be processed and no messages shall be - initiated. */ - break; - } - if (service_choice == SERVICE_CONFIRMED_READ_PROPERTY) { - handler_read_property(service_request, service_request_len, - src, &service_data); - } else if (service_choice == SERVICE_CONFIRMED_WRITE_PROPERTY) { - handler_write_property(service_request, service_request_len, - src, &service_data); - } else if (service_choice == - SERVICE_CONFIRMED_REINITIALIZE_DEVICE) { - handler_reinitialize_device(service_request, - service_request_len, src, &service_data); - } else if (service_choice == - SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL) { - handler_device_communication_control(service_request, - service_request_len, src, &service_data); - } else { - handler_unrecognized_service(service_request, - service_request_len, src, &service_data); - } - break; - case PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST: - service_choice = apdu[1]; - service_request = &apdu[2]; - service_request_len = apdu_len - 2; - if (apdu_unconfirmed_dcc_disabled(service_choice)) { - /* When network communications are disabled, - only DeviceCommunicationControl and ReinitializeDevice - APDUs shall be processed and no messages shall be - initiated. If communications have been initiation - disabled, then WhoIs may be processed. */ - break; - } - if (service_choice == SERVICE_UNCONFIRMED_WHO_IS) { - handler_who_is(service_request, service_request_len, src); - } - break; - case PDU_TYPE_SIMPLE_ACK: - case PDU_TYPE_COMPLEX_ACK: - case PDU_TYPE_SEGMENT_ACK: - case PDU_TYPE_ERROR: - case PDU_TYPE_REJECT: - case PDU_TYPE_ABORT: - default: - break; - } - } - return; -} diff --git a/ports/pic18f97j60/av.c b/ports/pic18f97j60/av.c deleted file mode 100644 index 316240fe..00000000 --- a/ports/pic18f97j60/av.c +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Analog Value Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/bacapp.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/av.h" - -#define MAX_ANALOG_VALUES 4 - -/* we choose to have a NULL level in our system represented by */ -/* a particular value. When the priorities are not in use, they */ -/* will be relinquished (i.e. set to the NULL level). */ -#define ANALOG_LEVEL_NULL 255 -/* When all the priorities are level null, the present value returns */ -/* the Relinquish Default value */ -#define ANALOG_RELINQUISH_DEFAULT 0 -/* Here is our Present_Value. They are supposed to be Real, but */ -/* we don't have that kind of memory, so we will use a single byte */ -/* and load a Real for returning the value when asked. */ -static uint8_t Present_Value[MAX_ANALOG_VALUES]; - -/* we need to have our arrays initialized before answering any calls */ -static bool Analog_Value_Initialized = false; - -void Analog_Value_Init(void) -{ - unsigned i; - - if (!Analog_Value_Initialized) { - Analog_Value_Initialized = true; - - /* initialize all the analog output priority arrays to NULL */ - for (i = 0; i < MAX_ANALOG_VALUES; i++) { - Present_Value[i] = ANALOG_LEVEL_NULL; - } - } - - return; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need validate that the */ -/* given instance exists */ -bool Analog_Value_Valid_Instance(uint32_t object_instance) -{ - Analog_Value_Init(); - if (object_instance < MAX_ANALOG_VALUES) - return true; - - return false; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then count how many you have */ -unsigned Analog_Value_Count(void) -{ - Analog_Value_Init(); - return MAX_ANALOG_VALUES; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the instance */ -/* that correlates to the correct index */ -uint32_t Analog_Value_Index_To_Instance(unsigned index) -{ - Analog_Value_Init(); - return index; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the index */ -/* that correlates to the correct instance number */ -unsigned Analog_Value_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_ANALOG_VALUES; - - Analog_Value_Init(); - if (object_instance < MAX_ANALOG_VALUES) - index = object_instance; - - return index; -} - -float Analog_Value_Present_Value(uint32_t object_instance) -{ - float value = ANALOG_RELINQUISH_DEFAULT; - unsigned index = 0; - unsigned i = 0; - - Analog_Value_Init(); - index = Analog_Value_Instance_To_Index(object_instance); - if (index < MAX_ANALOG_VALUES) { - value = Present_Value[index]; - } - - return value; -} - -/* note: the object name must be unique within this device */ -char *Analog_Value_Name(uint32_t object_instance) -{ - static char text[32] = ""; /* okay for single thread */ - - if (object_instance < MAX_ANALOG_VALUES) { - snprintf(text, sizeof(text), "AV-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int len = 0; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - float real_value = (float)1.414; - unsigned object_index = 0; - unsigned i = 0; - bool state = false; - uint8_t *apdu = NULL; - - Analog_Value_Init(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_ANALOG_VALUE, rpdata->object_instance); - break; - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Analog_Value_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE); - break; - case PROP_PRESENT_VALUE: - real_value = Analog_Value_Present_Value(rpdata->object_instance); - apdu_len = encode_application_real(&apdu[0], real_value); - break; - case PROP_STATUS_FLAGS: - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: -#if 0 - object_index = Analog_Value_Instance_To_Index(object_instance); - state = Analog_Value_Out_Of_Service[object_index]; -#endif - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_UNITS: - apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT); - break; -#if 0 - case PROP_PRIORITY_ARRAY: - /* Array element zero is the number of elements in the array */ - if (array_index == 0) - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY); - /* if no index was specified, then try to encode the entire list */ - /* into one packet. */ - else if (array_index == BACNET_ARRAY_ALL) { - object_index = Analog_Value_Instance_To_Index(object_instance); - for (i = 0; i < BACNET_MAX_PRIORITY; i++) { - /* FIXME: check if we have room before adding it to APDU */ - if (Present_Value[object_index][i] == ANALOG_LEVEL_NULL) - len = encode_application_null(&apdu[apdu_len]); - else { - real_value = Present_Value[object_index][i]; - len = - encode_application_real(&apdu[apdu_len], - real_value); - } - /* add it if we have room */ - if ((apdu_len + len) < MAX_APDU) - apdu_len += len; - else { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - apdu_len = BACNET_STATUS_ABORT; - break; - } - } - } else { - object_index = Analog_Value_Instance_To_Index(object_instance); - if (array_index <= BACNET_MAX_PRIORITY) { - if (Present_Value[object_index][array_index - 1] == - ANALOG_LEVEL_NULL) - apdu_len = encode_application_null(&apdu[0]); - else { - real_value = - Present_Value[object_index][array_index - 1]; - apdu_len = - encode_application_real(&apdu[0], real_value); - } - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - apdu_len = BACNET_STATUS_ERROR; - } - } - - break; - case PROP_RELINQUISH_DEFAULT: - real_value = ANALOG_RELINQUISH_DEFAULT; - apdu_len = encode_application_real(&apdu[0], real_value); - break; -#endif - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = BACNET_STATUS_ERROR; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && -#if 0 - (property != PROP_PRIORITY_ARRAY) && -#endif - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - unsigned int priority = 0; - uint8_t level = ANALOG_LEVEL_NULL; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - Analog_Value_Init(); - if (!Analog_Value_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_PRIORITY_ARRAY) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_REAL) { - priority = wp_data->priority; - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - if (priority && (priority <= BACNET_MAX_PRIORITY) && - (priority != 6 /* reserved */) && - (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { - level = (uint8_t)value.type.Real; - object_index = Analog_Value_Instance_To_Index( - wp_data->object_instance); - priority--; - Present_Value[object_index] = level; - /* Note: you could set the physical output here if we - are the highest priority. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing - output) */ - status = true; - } else if (priority == 6) { - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#if 0 - } else if (value.tag == BACNET_APPLICATION_TAG_NULL) { - level = ANALOG_LEVEL_NULL; - object_index = - Analog_Value_Instance_To_Index(wp_data->object_instance); - priority = wp_data->priority; - if (priority && (priority <= BACNET_MAX_PRIORITY)) { - priority--; - Present_Value[object_index][priority] = level; - /* Note: you could set the physical output here to the next - highest priority, or to the relinquish default if no - priorities are set. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing output) */ - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#endif - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#if 0 - case PROP_OUT_OF_SERVICE: - if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) { - object_index = - Analog_Value_Instance_To_Index(wp_data->object_instance); - Analog_Value_Out_Of_Service[object_index] = value.type.Boolean; - status = true; - } else { - *error_class = ERROR_CLASS_PROPERTY; - *error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#endif - case PROP_OBJECT_IDENTIFIER: - case PROP_OBJECT_NAME: - case PROP_OBJECT_TYPE: - case PROP_STATUS_FLAGS: - case PROP_EVENT_STATE: - case PROP_OUT_OF_SERVICE: - case PROP_DESCRIPTION: - case PROP_PRIORITY_ARRAY: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} diff --git a/ports/pic18f97j60/bi.c b/ports/pic18f97j60/bi.c deleted file mode 100644 index f5937bd6..00000000 --- a/ports/pic18f97j60/bi.c +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Input Objects customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/bi.h" - -#define MAX_BINARY_INPUTS 8 - -static BACNET_BINARY_PV Present_Value[MAX_BINARY_INPUTS]; - -static void Binary_Input_Initialize(void) -{ - static bool initialized = false; - unsigned i; - - if (!initialized) { - initialized = true; - for (i = 0; i < MAX_BINARY_INPUTS; i++) { - Present_Value[i] = BINARY_INACTIVE; - } - } -} - -/* we simply have 0-n object instances. */ -bool Binary_Input_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_INPUTS) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Input_Count(void) -{ - return MAX_BINARY_INPUTS; -} - -/* we simply have 0-n object instances.*/ -uint32_t Binary_Input_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. Yours might be */ -/* more complex, and then you need to return the index */ -/* that correlates to the correct instance number */ -unsigned Binary_Input_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_INPUTS; - - if (object_instance < MAX_BINARY_INPUTS) - index = object_instance; - - return index; -} - -BACNET_BINARY_PV Binary_Input_Present_Value(uint32_t object_instance) -{ - BACNET_BINARY_PV value = BINARY_INACTIVE; - unsigned index = 0; - - Binary_Input_Initialize(); - index = Binary_Input_Instance_To_Index(object_instance); - if (index < MAX_BINARY_INPUTS) { - value = Present_Value[index]; - } - - return value; -} - -char *Binary_Input_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_BINARY_INPUTS) { - snprintf(text, sizeof(text), "BI-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu length, or -1 on error */ -/* assumption - object already exists, and has been bounds checked */ -int Binary_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_POLARITY polarity = POLARITY_NORMAL; - BACNET_BINARY_PV value = BINARY_INACTIVE; - uint8_t *apdu = NULL; - - Binary_Input_Initialize(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_BINARY_INPUT, rpdata->object_instance); - break; - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - /* note: object name must be unique in our device */ - characterstring_init_ansi( - &char_string, Binary_Input_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_BINARY_INPUT); - break; - case PROP_PRESENT_VALUE: - value = Binary_Input_Present_Value(rpdata->object_instance); - apdu_len = encode_application_enumerated(&apdu[0], value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_POLARITY: - apdu_len = encode_application_enumerated(&apdu[0], polarity); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} diff --git a/ports/pic18f97j60/bv.c b/ports/pic18f97j60/bv.c deleted file mode 100644 index 0b319e83..00000000 --- a/ports/pic18f97j60/bv.c +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Value Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "bacnet/rp.h" -#include "bacnet/basic/object/bv.h" - -#define MAX_BINARY_VALUES 8 - -static BACNET_BINARY_PV Present_Value[MAX_BINARY_VALUES]; - -static void Binary_Value_Initialize(void) -{ - static bool initialized = false; - unsigned i; - - if (!initialized) { - initialized = true; - for (i = 0; i < MAX_BINARY_VALUES; i++) { - Present_Value[i] = BINARY_INACTIVE; - } - } -} - -/* we simply have 0-n object instances. */ -bool Binary_Value_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_VALUES) - return true; - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Count(void) -{ - return MAX_BINARY_VALUES; -} - -/* we simply have 0-n object instances. */ -uint32_t Binary_Value_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Value_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_VALUES; - - if (object_instance < MAX_BINARY_VALUES) - index = object_instance; - - return index; -} - -BACNET_BINARY_PV Binary_Value_Present_Value(uint32_t object_instance) -{ - BACNET_BINARY_PV value = BINARY_INACTIVE; - - Binary_Value_Initialize(); - if (object_instance < MAX_BINARY_VALUES) { - value = Present_Value[object_instance]; - } - - return value; -} - -/* note: the object name must be unique within this device */ -char *Binary_Value_Name(uint32_t object_instance) -{ - static char text[16] = ""; /* okay for single thread */ - - if (object_instance < MAX_BINARY_VALUES) { - snprintf(text, sizeof(text), "BV-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int len = 0; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_BINARY_PV present_value = BINARY_INACTIVE; - BACNET_POLARITY polarity = POLARITY_NORMAL; - unsigned object_index = 0; - unsigned i = 0; - bool state = false; - uint8_t *apdu = NULL; - - Binary_Value_Initialize(); - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_BINARY_VALUE, rpdata->object_instance); - break; - /* note: Name and Description don't have to be the same. - You could make Description writable and different */ - case PROP_OBJECT_NAME: - case PROP_DESCRIPTION: - characterstring_init_ansi( - &char_string, Binary_Value_Name(rpdata->object_instance)); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE); - break; - case PROP_PRESENT_VALUE: - present_value = Binary_Value_Present_Value(rpdata->object_instance); - apdu_len = encode_application_enumerated(&apdu[0], present_value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case PROP_POLARITY: - /* FIXME: figure out the polarity */ - apdu_len = encode_application_enumerated(&apdu[0], polarity); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = -1; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - unsigned int object_index = 0; - unsigned int priority = 0; - BACNET_BINARY_PV level = BINARY_NULL; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Binary_Value_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_PRIORITY_ARRAY) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) { - priority = wp_data->priority; - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - if (priority && (priority <= BACNET_MAX_PRIORITY) && - (priority != 6 /* reserved */) && - (value.type.Enumerated >= MIN_BINARY_PV) && - (value.type.Enumerated <= MAX_BINARY_PV)) { - level = value.type.Enumerated; - object_index = Binary_Value_Instance_To_Index( - wp_data->object_instance); - priority--; - /* NOTE: this Binary value has no priority array */ - Present_Value[object_index] = level; - /* Note: you could set the physical output here if we - are the highest priority. - However, if Out of Service is TRUE, then don't set the - physical output. */ - status = true; - } else if (priority == 6) { - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else if (value.tag == BACNET_APPLICATION_TAG_NULL) { -#if 0 - /* NOTE: this Binary Value has no priority array */ - level = BINARY_NULL; - object_index = - Binary_Value_Instance_To_Index(wp_data->object_instance); - priority = wp_data->priority; - if (priority && (priority <= BACNET_MAX_PRIORITY)) { - priority--; - Binary_Value_Level[object_index][priority] = level; - /* Note: you could set the physical output here to the next - highest priority, or to the relinquish default if no - priorities are set. - However, if Out of Service is TRUE, then don't set the - physical output. This comment may apply to the - main loop (i.e. check out of service before changing output) */ - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } -#else - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; -#endif - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_OUT_OF_SERVICE: -#if 0 - if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) { - object_index = - Binary_Value_Instance_To_Index(wp_data->object_instance); - Binary_Value_Out_Of_Service[object_index] = value.type.Boolean; - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; -#endif - case PROP_OBJECT_IDENTIFIER: - case PROP_OBJECT_NAME: - case PROP_OBJECT_TYPE: - case PROP_STATUS_FLAGS: - case PROP_EVENT_STATE: - case PROP_POLARITY: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} diff --git a/ports/pic18f97j60/device.c b/ports/pic18f97j60/device.c deleted file mode 100644 index 8af3e379..00000000 --- a/ports/pic18f97j60/device.c +++ /dev/null @@ -1,706 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include /* for memmove */ -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacstr.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/apdu.h" -#include "bacnet/datalink/dlmstp.h" -#include "rs485.h" -#include "bacnet/basic/object/ai.h" -#include "bacnet/basic/object/av.h" -#include "bacnet/basic/object/bi.h" -#include "bacnet/basic/object/bv.h" -#include "bacnet/rp.h" -#include "bacnet/wp.h" -#include "bacnet/dcc.h" -#include "bacnet/version.h" -#include "bacnet/basic/object/device.h" /* me */ - -/* note: you really only need to define variables for - properties that are writable or that may change. - The properties that are constant can be hard coded - into the read-property encoding. */ -static uint32_t Object_Instance_Number = 12345; -static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL; -static uint8_t Database_Revision; -BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE; - -bool Device_Reinitialize(BACNET_REINITIALIZE_DEVICE_DATA *rd_data) -{ - bool status = false; - char password[16] = "filister"; - - if (characterstring_ansi_same(&rd_data->password, password)) { - Reinitialize_State = rd_data->state; - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); - /* Note: you could use a mix of state - and password to multiple things */ - /* note: you probably want to restart *after* the - simple ack has been sent from the return handler - so just set a flag from here */ - status = true; - } else { - rd_data->error_class = ERROR_CLASS_SECURITY; - rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE; - } - - return status; -} - -BACNET_REINITIALIZED_STATE Device_Reinitialized_State(void) -{ - return Reinitialize_State; -} - -void Device_Init(object_functions_t *object_table) -{ - (void)object_table; - Reinitialize_State = BACNET_REINIT_IDLE; - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); - /* FIXME: Get the data from the eeprom */ - /* I2C_Read_Block(EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ -} - -/* methods to manipulate the data */ -uint32_t Device_Object_Instance_Number(void) -{ - return Object_Instance_Number; -} - -bool Device_Set_Object_Instance_Number(uint32_t object_id) -{ - bool status = true; /* return value */ - - if (object_id <= BACNET_MAX_INSTANCE) { - Object_Instance_Number = object_id; - Database_Revision++; - /* FIXME: Write the data to the eeprom */ - /* I2C_Write_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&Object_Instance_Number, - sizeof(Object_Instance_Number), - EEPROM_BACNET_ID_ADDR); */ - } else - status = false; - - return status; -} - -bool Device_Valid_Object_Instance_Number(uint32_t object_id) -{ - /* BACnet allows for a wildcard instance number */ - return (Object_Instance_Number == object_id); -} - -BACNET_DEVICE_STATUS Device_System_Status(void) -{ - return System_Status; -} - -int Device_Set_System_Status(BACNET_DEVICE_STATUS status, bool local) -{ - if (status < MAX_DEVICE_STATUS) { - System_Status = status; - } -} - -uint16_t Device_Vendor_Identifier(void) -{ - return BACNET_VENDOR_ID; -} - -uint8_t Device_Protocol_Version(void) -{ - return BACNET_PROTOCOL_VERSION; -} - -uint8_t Device_Protocol_Revision(void) -{ - return BACNET_PROTOCOL_REVISION; -} - -BACNET_SEGMENTATION Device_Segmentation_Supported(void) -{ - return SEGMENTATION_NONE; -} - -uint32_t Device_Database_Revision(void) -{ - return Database_Revision; -} - -/* Since many network clients depend on the object list */ -/* for discovery, it must be consistent! */ -unsigned Device_Object_List_Count(void) -{ - unsigned count = 1; /* at least 1 for device object */ - - /* FIXME: add objects as needed */ - count += Binary_Value_Count(); - count += Analog_Input_Count(); - count += Binary_Input_Count(); - count += Analog_Value_Count(); - - return count; -} - -/* Since many network clients depend on the object list */ -/* for discovery, it must be consistent! */ -bool Device_Object_List_Identifier( - uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance) -{ - bool status = false; - uint32_t object_index = 0; - uint32_t object_count = 0; - - /* device object */ - if (array_index == 1) { - *object_type = OBJECT_DEVICE; - *instance = Object_Instance_Number; - status = true; - } - /* normalize the index since - we know it is not the previous objects */ - /* array index starts at 1 */ - object_index = array_index - 1; - /* 1 for the device object */ - object_count = 1; - /* FIXME: add objects as needed */ - /* binary value objects */ - if (!status) { - object_index -= object_count; - object_count = Binary_Value_Count(); - /* is it a valid index for this object? */ - if (object_index < object_count) { - *object_type = OBJECT_BINARY_VALUE; - *instance = Binary_Value_Index_To_Instance(object_index); - status = true; - } - } - /* analog input objects */ - if (!status) { - /* array index starts at 1, and 1 for the device object */ - object_index -= object_count; - object_count = Analog_Value_Count(); - if (object_index < object_count) { - *object_type = OBJECT_ANALOG_VALUE; - *instance = Analog_Value_Index_To_Instance(object_index); - status = true; - } - } - /* analog input objects */ - if (!status) { - /* array index starts at 1, and 1 for the device object */ - object_index -= object_count; - object_count = Analog_Input_Count(); - if (object_index < object_count) { - *object_type = OBJECT_ANALOG_INPUT; - *instance = Analog_Input_Index_To_Instance(object_index); - status = true; - } - } - /* binary input objects */ - if (!status) { - /* normalize the index since - we know it is not the previous objects */ - object_index -= object_count; - object_count = Binary_Input_Count(); - /* is it a valid index for this object? */ - if (object_index < object_count) { - *object_type = OBJECT_BINARY_INPUT; - *instance = Binary_Input_Index_To_Instance(object_index); - status = true; - } - } - - return status; -} - -/** - * @brief Encode a BACnetARRAY property element - * @param object_instance [in] BACnet network port object instance number - * @param array_index [in] array index requested: - * 0 to N for individual array members - * @param apdu [out] Buffer in which the APDU contents are built, or NULL to - * return the length of buffer if it had been built - * @return The length of the apdu encoded or - * BACNET_STATUS_ERROR for ERROR_CODE_INVALID_ARRAY_INDEX - */ -int Device_Object_List_Element_Encode( - uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu) -{ - int apdu_len = BACNET_STATUS_ERROR; - BACNET_OBJECT_TYPE object_type; - uint32_t instance; - bool found; - - if (object_instance == Device_Object_Instance_Number()) { - /* single element is zero based, add 1 for BACnetARRAY which is one - * based */ - array_index++; - found = - Device_Object_List_Identifier(array_index, &object_type, &instance); - if (found) { - apdu_len = - encode_application_object_id(apdu, object_type, instance); - } - } - - return apdu_len; -} - -/* returns true if successful */ -int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - uint32_t i = 0; - uint32_t count = 0; - BACNET_TIME local_time; - BACNET_DATE local_date; - uint8_t year = 0; - char string_buffer[28]; - int16_t TimeZone = 0; - uint8_t *apdu = NULL; - int apdu_max = 0; - - if ((rpdata == NULL) || (rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - apdu_max = rpdata->application_data_len; - /* FIXME: change the hardcoded names to suit your application */ - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - apdu_len = encode_application_object_id( - &apdu[0], OBJECT_DEVICE, Object_Instance_Number); - break; - case PROP_OBJECT_NAME: - (void)strcpypgm2ram(&string_buffer[0], "PIC18F6720 Device"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = encode_application_enumerated(&apdu[0], OBJECT_DEVICE); - break; - case PROP_DESCRIPTION: - (void)strcpypgm2ram(&string_buffer[0], "BACnet Demo"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_SYSTEM_STATUS: - apdu_len = - encode_application_enumerated(&apdu[0], Device_System_Status()); - break; - case PROP_VENDOR_NAME: - (void)strcpypgm2ram(&string_buffer[0], BACNET_VENDOR_NAME); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_VENDOR_IDENTIFIER: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Vendor_Identifier()); - break; - case PROP_MODEL_NAME: - (void)strcpypgm2ram(&string_buffer[0], "GNU Demo"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_FIRMWARE_REVISION: - (void)strcpypgm2ram(&string_buffer[0], BACNET_VERSION_TEXT); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_APPLICATION_SOFTWARE_VERSION: - (void)strcpypgm2ram(&string_buffer[0], "1.0"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_LOCATION: - (void)strcpypgm2ram(&string_buffer[0], "USA"); - characterstring_init_ansi(&char_string, string_buffer); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_PROTOCOL_VERSION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Protocol_Version()); - break; - case PROP_PROTOCOL_REVISION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Protocol_Revision()); - break; - case PROP_PROTOCOL_SERVICES_SUPPORTED: - /* Note: list of services that are executed, not initiated. */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { - /* automatic lookup based on handlers set */ - bitstring_set_bit( - &bit_string, (uint8_t)i, apdu_service_supported(i)); - } - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - /* Note: this is the list of objects that can be in this device, - not a list of objects that this device can access */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_ASHRAE_OBJECT_TYPE; i++) { - /* initialize all the object types to not-supported */ - bitstring_set_bit(&bit_string, (uint8_t)i, false); - } - /* FIXME: indicate the objects that YOU support */ - bitstring_set_bit(&bit_string, OBJECT_DEVICE, true); - bitstring_set_bit(&bit_string, OBJECT_ANALOG_VALUE, true); - bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true); - bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true); - bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_OBJECT_LIST: - count = Device_Object_List_Count(); - apdu_len = bacnet_array_encode(rpdata->object_instance, - rpdata->array_index, - Device_Object_List_Element_Encode, - count, apdu, apdu_max); - if (apdu_len == BACNET_STATUS_ABORT) { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - } else if (apdu_len == BACNET_STATUS_ERROR) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - } - break; - case PROP_MAX_APDU_LENGTH_ACCEPTED: - apdu_len = encode_application_unsigned(&apdu[0], MAX_APDU); - break; - case PROP_SEGMENTATION_SUPPORTED: - apdu_len = encode_application_enumerated( - &apdu[0], Device_Segmentation_Supported()); - break; - case PROP_APDU_TIMEOUT: - apdu_len = encode_application_unsigned(&apdu[0], apdu_timeout()); - break; - case PROP_NUMBER_OF_APDU_RETRIES: - apdu_len = encode_application_unsigned(&apdu[0], apdu_retries()); - break; - case PROP_DEVICE_ADDRESS_BINDING: - /* FIXME: encode the list here, if it exists */ - break; - case PROP_DATABASE_REVISION: - apdu_len = encode_application_unsigned( - &apdu[0], Device_Database_Revision()); - break; - case PROP_MAX_INFO_FRAMES: - apdu_len = - encode_application_unsigned(&apdu[0], dlmstp_max_info_frames()); - break; - case PROP_MAX_MASTER: - apdu_len = - encode_application_unsigned(&apdu[0], dlmstp_max_master()); - break; - case PROP_LOCAL_TIME: - /* FIXME: if you support time */ - local_time.hour = 0; - local_time.min = 0; - local_time.sec = 0; - local_time.hundredths = 0; - apdu_len = encode_application_time(&apdu[0], &local_time); - break; - case PROP_UTC_OFFSET: - /* Note: BACnet Time Zone is offset of local time and UTC, - rather than offset of GMT. It is expressed in minutes */ - apdu_len = encode_application_signed(&apdu[0], 5 * 60 /* EST */); - break; - case PROP_LOCAL_DATE: - /* FIXME: if you support date */ - local_date.year = 2006; /* AD */ - local_date.month = 4; /* Jan=1..Dec=12 */ - local_date.day = 11; /* 1..31 */ - local_date.wday = 0; /* 1=Mon..7=Sun */ - apdu_len = encode_application_date(&apdu[0], &local_date); - break; - case PROP_DAYLIGHT_SAVINGS_STATUS: - /* FIXME: if you support time/date */ - apdu_len = encode_application_boolean(&apdu[0], false); - break; - case 9600: - apdu_len = - encode_application_unsigned(&apdu[0], RS485_Get_Baud_Rate()); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = -1; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->object_property != PROP_OBJECT_LIST) && - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = BACNET_STATUS_ERROR; - - /* initialize the default return values */ - rpdata->error_class = ERROR_CLASS_OBJECT; - rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT; - switch (rpdata->object_type) { - case OBJECT_ANALOG_INPUT: - if (Analog_Input_Valid_Instance(rpdata->object_instance)) { - apdu_len = Analog_Input_Read_Property(rpdata); - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Valid_Instance(rpdata->object_instance)) { - apdu_len = Analog_Value_Read_Property(rpdata); - } - break; - case OBJECT_BINARY_INPUT: - if (Binary_Input_Valid_Instance(rpdata->object_instance)) { - apdu_len = Binary_Input_Read_Property(rpdata); - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Valid_Instance(rpdata->object_instance)) { - apdu_len = Binary_Value_Read_Property(rpdata); - } - break; - case OBJECT_DEVICE: - if (Device_Valid_Object_Instance_Number(rpdata->object_instance)) { - apdu_len = Device_Read_Property_Local(rpdata); - } - break; - default: - break; - } - - return apdu_len; -} - -bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - if (!Device_Valid_Object_Instance_Number(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - return false; - } - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_OBJECT_LIST) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_OBJECT_IDENTIFIER: - if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { - if ((value.type.Object_Id.type == OBJECT_DEVICE) && - (Device_Set_Object_Instance_Number( - value.type.Object_Id.instance))) { - /* we could send an I-Am broadcast to let the world know */ - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_MAX_INFO_FRAMES: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if (value.type.Unsigned_Int <= 255) { - dlmstp_set_max_info_frames(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_MAX_MASTER: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if ((value.type.Unsigned_Int > 0) && - (value.type.Unsigned_Int <= 127)) { - dlmstp_set_max_master(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_OBJECT_NAME: - if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) { - uint8_t encoding; - size_t len; - - encoding = - characterstring_encoding(&value.type.Character_String); - len = characterstring_length(&value.type.Character_String); - if (encoding == CHARACTER_ANSI_X34) { - if (len <= 20) { - /* FIXME: set the name */ - /* Display_Set_Name( - characterstring_value(&value.type.Character_String)); - */ - /* FIXME: All the object names in a device must be - unique. Disallow setting the Device Object Name to - any objects in the device. */ - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = - ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = - ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case 9600: - if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - if (value.type.Unsigned_Int > 115200) { - RS485_Set_Baud_Rate(value.type.Unsigned_Int); - status = true; - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE; - } - break; - case PROP_NUMBER_OF_APDU_RETRIES: - case PROP_APDU_TIMEOUT: - case PROP_VENDOR_IDENTIFIER: - case PROP_SYSTEM_STATUS: - case PROP_LOCATION: - case PROP_DESCRIPTION: - case PROP_MODEL_NAME: - case PROP_VENDOR_NAME: - case PROP_FIRMWARE_REVISION: - case PROP_APPLICATION_SOFTWARE_VERSION: - case PROP_LOCAL_TIME: - case PROP_UTC_OFFSET: - case PROP_LOCAL_DATE: - case PROP_DAYLIGHT_SAVINGS_STATUS: - case PROP_PROTOCOL_VERSION: - case PROP_PROTOCOL_REVISION: - case PROP_PROTOCOL_SERVICES_SUPPORTED: - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - case PROP_OBJECT_LIST: - case PROP_MAX_APDU_LENGTH_ACCEPTED: - case PROP_SEGMENTATION_SUPPORTED: - case PROP_DEVICE_ADDRESS_BINDING: - case PROP_DATABASE_REVISION: - case PROP_ACTIVE_COV_SUBSCRIPTIONS: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - - return status; -} - -bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* Ever the pessamist! */ - struct object_functions *pObject = NULL; - - /* initialize the default return values */ - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - switch (wp_data->object_type) { - case OBJECT_ANALOG_INPUT: - if (Analog_Input_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } - break; - case OBJECT_ANALOG_VALUE: - if (Analog_Value_Valid_Instance(wp_data->object_instance)) { - status = Analog_Value_Write_Property(wp_data); - } - break; - case OBJECT_BINARY_INPUT: - if (Binary_Input_Valid_Instance(wp_data->object_instance)) { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } - break; - case OBJECT_BINARY_VALUE: - if (Binary_Value_Valid_Instance(wp_data->object_instance)) { - status = Binary_Value_Write_Property(wp_data); - } - break; - case OBJECT_DEVICE: - if (Device_Valid_Object_Instance_Number(wp_data->object_instance)) { - status = Device_Write_Property_Local(wp_data); - } - break; - default: - break; - } - - return (status); -} diff --git a/ports/pic18f97j60/dlmstp.c b/ports/pic18f97j60/dlmstp.c deleted file mode 100644 index 7e677ab3..00000000 --- a/ports/pic18f97j60/dlmstp.c +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2006 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -#include -#include -#if PRINT_ENABLED -#include -#endif -#include "bacnet/bacdef.h" -#include "bacnet/datalink/mstp.h" -#include "bacnet/datalink/dlmstp.h" -#include "rs485.h" -#include "bacnet/npdu.h" -#include "bacnet/basic/services.h" - -/* Number of MS/TP Packets Rx/Tx */ -uint16_t MSTP_Packets = 0; - -/* receive buffer */ -#pragma udata MSTP_RxData -static DLMSTP_PACKET Receive_Buffer; -/* temp buffer for NPDU insertion */ -/* local MS/TP port data - shared with RS-485 */ -#pragma udata MSTP_PortData -volatile struct mstp_port_struct_t MSTP_Port; -#pragma udata - -#define INCREMENT_AND_LIMIT_UINT16(x) \ - { \ - if (x < 0xFFFF) \ - x++; \ - } - -void dlmstp_millisecond_timer(void) -{ - INCREMENT_AND_LIMIT_UINT16(MSTP_Port.SilenceTimer); -} - -void dlmstp_reinit(void) -{ - RS485_Reinit(); - dlmstp_set_my_address(DEFAULT_MAC_ADDRESS); - dlmstp_set_max_info_frames(DEFAULT_MAX_INFO_FRAMES); - dlmstp_set_max_master(DEFAULT_MAX_MASTER); -} - -void dlmstp_init(void) -{ - uint8_t data; - - /* initialize buffer */ - Receive_Buffer.ready = false; - Receive_Buffer.pdu_len = 0; - /* initialize hardware */ - RS485_Initialize(); - MSTP_Port.InputBuffer = &Receive_Buffer.pdu[0]; - MSTP_Init(&MSTP_Port); -} - -void dlmstp_cleanup(void) -{ - /* nothing to do for static buffers */ -} - -/* returns number of bytes sent on success, zero on failure */ -int dlmstp_send_pdu(BACNET_ADDRESS *dest, /* destination address */ - BACNET_NPDU_DATA *npdu_data, /* network information */ - uint8_t *pdu, /* any data to be sent - may be null */ - unsigned pdu_len) -{ /* number of bytes of data */ - int bytes_sent = 0; - unsigned npdu_len = 0; - uint8_t frame_type = 0; - BACNET_ADDRESS src; - unsigned i = 0; /* loop counter */ - - if (MSTP_Port.TxReady == false) { - if (npdu_data->data_expecting_reply) - MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY; - else - MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY; - - /* load destination MAC address */ - if (dest && dest->mac_len) { - MSTP_Port.TxDestination = dest->mac[0]; - } else { - /* mac_len = 0 is a broadcast address */ - MSTP_Port.TxDestination = MSTP_BROADCAST_ADDRESS; - } - dlmstp_get_my_address(&src); - if ((DLMSTP_HEADER_MAX + pdu_len) > DLMSTP_MPDU_MAX) { - return -4; - } - bytes_sent = MSTP_Create_Frame((uint8_t *)&MSTP_Port.TxBuffer[0], - sizeof(MSTP_Port.TxBuffer), MSTP_Port.TxFrameType, - MSTP_Port.TxDestination, MSTP_Port.This_Station, pdu, pdu_len); - MSTP_Port.TxLength = bytes_sent; - MSTP_Port.TxReady = true; - MSTP_Packets++; - } - - return bytes_sent; -} - -void dlmstp_task(void) -{ - bool bytes_remaining; - bool received_frame; - - /* only do receive state machine while we don't have a frame */ - if ((MSTP_Port.ReceivedValidFrame == false) && - (MSTP_Port.ReceivedInvalidFrame == false)) { - do { - bytes_remaining = RS485_Check_UART_Data(&MSTP_Port); - MSTP_Receive_Frame_FSM(&MSTP_Port); - received_frame = - MSTP_Port.ReceivedValidFrame || MSTP_Port.ReceivedInvalidFrame; - if (received_frame) - break; - } while (bytes_remaining); - } - /* only do master state machine while rx is idle */ - if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE) { - if (MSTP_Port.This_Station <= DEFAULT_MAX_MASTER) { - while (MSTP_Master_Node_FSM(&MSTP_Port)) { - /* do nothing while some states fast transition */ - }; - } - } - /* see if there is a packet available, and a place - to put the reply (if necessary) and process it */ - if (Receive_Buffer.ready && !MSTP_Port.TxReady) { - if (Receive_Buffer.pdu_len) { - MSTP_Packets++; - npdu_handler(&Receive_Buffer.address, &Receive_Buffer.pdu[0], - Receive_Buffer.pdu_len); - } - Receive_Buffer.ready = false; - } - - return; -} - -void dlmstp_fill_bacnet_address(BACNET_ADDRESS *src, uint8_t mstp_address) -{ - int i = 0; - - if (mstp_address == MSTP_BROADCAST_ADDRESS) { - /* mac_len = 0 if broadcast address */ - src->mac_len = 0; - src->mac[0] = 0; - } else { - src->mac_len = 1; - src->mac[0] = mstp_address; - } - /* fill with 0's starting with index 1; index 0 filled above */ - for (i = 1; i < MAX_MAC_LEN; i++) { - src->mac[i] = 0; - } - src->net = 0; - src->len = 0; - for (i = 0; i < MAX_MAC_LEN; i++) { - src->adr[i] = 0; - } -} - -/* for the MS/TP state machine to use for putting received data */ -uint16_t dlmstp_put_receive(uint8_t src, /* source MS/TP address */ - uint8_t *pdu, /* PDU data */ - uint16_t pdu_len) -{ /* amount of PDU data */ - /* PDU is already in the Receive_Buffer */ - dlmstp_fill_bacnet_address(&Receive_Buffer.address, src); - Receive_Buffer.pdu_len = pdu_len; - Receive_Buffer.ready = true; -} - -void dlmstp_set_my_address(uint8_t mac_address) -{ - /* Master Nodes can only have address 0-127 */ - if (mac_address <= 127) { - MSTP_Port.This_Station = mac_address; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - mac_address, - EEPROM_MSTP_MAC_ADDR); */ - if (mac_address > MSTP_Port.Nmax_master) - dlmstp_set_max_master(mac_address); - } - - return; -} - -uint8_t dlmstp_my_address(void) -{ - return MSTP_Port.This_Station; -} - -/* This parameter represents the value of the Max_Info_Frames property of */ -/* the node's Device object. The value of Max_Info_Frames specifies the */ -/* maximum number of information frames the node may send before it must */ -/* pass the token. Max_Info_Frames may have different values on different */ -/* nodes. This may be used to allocate more or less of the available link */ -/* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ -/* node, its value shall be 1. */ -void dlmstp_set_max_info_frames(uint8_t max_info_frames) -{ - if (max_info_frames >= 1) { - MSTP_Port.Nmax_info_frames = max_info_frames; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - (uint8_t)max_info_frames, - EEPROM_MSTP_MAX_INFO_FRAMES_ADDR); */ - } - - return; -} - -unsigned dlmstp_max_info_frames(void) -{ - return MSTP_Port.Nmax_info_frames; -} - -/* This parameter represents the value of the Max_Master property of the */ -/* node's Device object. The value of Max_Master specifies the highest */ -/* allowable address for master nodes. The value of Max_Master shall be */ -/* less than or equal to 127. If Max_Master is not writable in a node, */ -/* its value shall be 127. */ -void dlmstp_set_max_master(uint8_t max_master) -{ - if (max_master <= 127) { - if (MSTP_Port.This_Station <= max_master) { - MSTP_Port.Nmax_master = max_master; - /* FIXME: implement your data storage */ - /* I2C_Write_Byte( - EEPROM_DEVICE_ADDRESS, - max_master, - EEPROM_MSTP_MAX_MASTER_ADDR); */ - } - } - - return; -} - -uint8_t dlmstp_max_master(void) -{ - return MSTP_Port.Nmax_master; -} - -void dlmstp_get_my_address(BACNET_ADDRESS *my_address) -{ - int i = 0; /* counter */ - - my_address->mac_len = 1; - my_address->mac[0] = MSTP_Port.This_Station; - my_address->net = 0; /* local only, no routing */ - my_address->len = 0; - for (i = 0; i < MAX_MAC_LEN; i++) { - my_address->adr[i] = 0; - } - - return; -} - -void dlmstp_get_broadcast_address(BACNET_ADDRESS *dest) -{ /* destination address */ - int i = 0; /* counter */ - - if (dest) { - dest->mac_len = 1; - dest->mac[0] = MSTP_BROADCAST_ADDRESS; - dest->net = BACNET_BROADCAST_NETWORK; - dest->len = 0; /* always zero when DNET is broadcast */ - for (i = 0; i < MAX_MAC_LEN; i++) { - dest->adr[i] = 0; - } - } - - return; -} diff --git a/ports/pic18f97j60/dlmstp.h b/ports/pic18f97j60/dlmstp.h deleted file mode 100644 index f0b745e8..00000000 --- a/ports/pic18f97j60/dlmstp.h +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef DLMSTP_H -#define DLMSTP_H - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/npdu.h" - -/* defines specific to MS/TP */ -#define DLMSTP_HEADER_MAX (2+1+1+1+2+1) -#define DLMSTP_MPDU_MAX (DLMSTP_HEADER_MAX+MAX_PDU) - -typedef struct dlmstp_packet { - bool ready; /* true if ready to be sent or received */ - BACNET_ADDRESS address; /* source address */ - uint8_t frame_type; /* type of message */ - unsigned pdu_len; /* packet length */ - uint8_t pdu[DLMSTP_MPDU_MAX]; /* packet */ -} DLMSTP_PACKET; - -/* number of MS/TP tx/rx packets */ -extern uint16_t MSTP_Packets; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void dlmstp_reinit( - void); - void dlmstp_init( - void); - void dlmstp_cleanup( - void); - void dlmstp_millisecond_timer( - void); - void dlmstp_task( - void); - - /* returns number of bytes sent on success, negative on failure */ - int dlmstp_send_pdu( - BACNET_ADDRESS * dest, /* destination address */ - BACNET_NPDU_DATA * npdu_data, /* network information */ - uint8_t * pdu, /* any data to be sent - may be null */ - unsigned pdu_len); /* number of bytes of data */ - - /* This parameter represents the value of the Max_Info_Frames property of */ - /* the node's Device object. The value of Max_Info_Frames specifies the */ - /* maximum number of information frames the node may send before it must */ - /* pass the token. Max_Info_Frames may have different values on different */ - /* nodes. This may be used to allocate more or less of the available link */ - /* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ - /* node, its value shall be 1. */ - void dlmstp_set_max_info_frames( - uint8_t max_info_frames); - unsigned dlmstp_max_info_frames( - void); - - /* This parameter represents the value of the Max_Master property of the */ - /* node's Device object. The value of Max_Master specifies the highest */ - /* allowable address for master nodes. The value of Max_Master shall be */ - /* less than or equal to 127. If Max_Master is not writable in a node, */ - /* its value shall be 127. */ - void dlmstp_set_max_master( - uint8_t max_master); - uint8_t dlmstp_max_master( - void); - - /* MAC address for MS/TP */ - void dlmstp_set_my_address( - uint8_t my_address); - uint8_t dlmstp_my_address( - void); - - /* BACnet address used in datalink */ - void dlmstp_get_my_address( - BACNET_ADDRESS * my_address); - void dlmstp_get_broadcast_address( - BACNET_ADDRESS * dest); /* destination address */ - - /* MS/TP state machine functions */ - uint16_t dlmstp_put_receive( - uint8_t src, /* source MS/TP address */ - uint8_t * pdu, /* PDU data */ - uint16_t pdu_len); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f97j60/hardware.h b/ports/pic18f97j60/hardware.h deleted file mode 100644 index f31801b6..00000000 --- a/ports/pic18f97j60/hardware.h +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************** -* -* Copyright (C) 2007 Steve Karg -* -* SPDX-License-Identifier: MIT -* -*********************************************************************/ -#ifndef HARDWARE_H -#define HARDWARE_H - -#include -#include -#include - -/* PORTA.0 Photocell Input PORTA.1 LED Row6 PORTA.2 LED Row5 PORTA.3 LED - * Row4 PORTA.4 Square Wave input from RTC PORTA.5 LCD RW PORTB.0 Zero - * Cross PORTB.1 USB RXF# PORTB.2 USB TXE# PORTB.3 Keypad Row Enable - * (74HC373 Output Control) PORTB.4 Keypad Row Gate (74HC373 Gate) - * PORTB.5 Switch Input Latch & Keypad Column Gate (74HC373 Gate) PORTB.6 - * ICD connection PORTB.7 ICD connection PORTC.0 Pilot Latch PORTC.1 - * Pilot Output Enable (low) PORTC.2 Piezo PORTC.3 I2C clock PORTC.4 I2C - * data PORTC.5 RS232 enable (low) PORTC.6 RS232 Tx PORTC.7 RS232 Rx - * PORTD.0 Data bus PORTD.1 Data bus PORTD.2 Data bus PORTD.3 Data bus - * PORTD.4 Data bus PORTD.5 Data bus PORTD.6 Data bus PORTD.7 Data bus - * PORTE.0 USB RD PORTE.1 USB WR PORTE.2 LCD RS PORTE.3 485 transmit - * enable PORTE.4 Relay data latch PORTE.5 Switch Input Clock PORTE.6 - * Switch Input High/Low PORTE.7 Switch Input Data PORTF.0 LED Row2 - * PORTF.1 LED Row1 PORTF.2 LED Col5 PORTF.3 LED Col4 PORTF.4 LED Col3 - * PORTF.5 LED Col2 PORTF.6 LED Col1 PORTF.7 LED Col0 PORTG.0 485 receive - * enable PORTG.1 485 Tx PORTG.2 485 Rx PORTG.3 LCD E PORTG.4 LED Row0 */ -#define RS485_TX_ENABLE PORTEbits.RE3 -#define RS485_RX_DISABLE PORTGbits.RG0 - -#define LEDPORT PORTG -#define LEDTRIS TRISG -#define LED_ROW1 PORTGbits.RG1 -#define LED_ROW2 PORTGbits.RG2 -#define LED_ROW3 PORTGbits.RG3 -#define LED_ROW4 PORTGbits.RG4 - -#define TURN_OFF_COMPARATORS() CMCON = 0x07 - -enum INT_STATE { INT_DISABLED, INT_ENABLED, INT_RESTORE }; - -#define RESTART_WDT() { _asm CLRWDT _endasm } - -/* ************************************************************************* - define ENABLE_GLOBAL_INT() INTCONbits.GIE = 1 - #define DISABLE_GLOBAL_INT() INTCONbits.GIE = 0 - #define ENABLE_PERIPHERAL_INT() INTCONbits.PEIE = 1 - #define DISABLE_PERIPHERAL_INT() INTCONbits.PEIE = 0 - *************************************************************************** */ -#define ENABLE_HIGH_INT() INTCONbits.GIE = 1 -#define DISABLE_HIGH_INT() INTCONbits.GIE = 0 - -#define ENABLE_LOW_INT() INTCONbits.PEIE = 1 -#define DISABLE_LOW_INT() INTCONbits.PEIE = 0 - -#define ENABLE_TIMER0_INT() INTCONbits.TMR0IE = 1 -#define DISABLE_TIMER0_INT() INTCONbits.TMR0IE = 0 - -#define ENABLE_TIMER2_INT() PIE1bits.TMR2IE = 1 -#define DISABLE_TIMER2_INT() PIE1bits.TMR2IE = 0 - -#define ENABLE_TIMER4_INT() PIE3bits.TMR4IE = 1 -#define DISABLE_TIMER4_INT() PIE3bits.TMR4IE = 0 - -#define ENABLE_CCP2_INT() PIE2bits.CCP2IE = 1 -#define DISABLE_CCP2_INT() PIE2bits.CCP2IE = 0 - -#define ENABLE_CCP1_INT() PIE1bits.CCP1IE = 1 -#define DISABLE_CCP1_INT() PIE1bits.CCP1IE = 0 - -#define ENABLE_ABUS_INT() PIE1bits.SSPIE = 1 -#define DISABLE_ABUS_INT() PIE1bits.SSPIE = 0 -#define CLEAR_ABUS_FLAG() PIR1bits.SSPIF = 0 - -#define SETUP_CCP1(x) CCP1CON = x -#define SETUP_CCP2(x) CCP2CON = x - -#define DISABLE_RX_INT() PIE1bits.RCIE = 0 -#define ENABLE_RX_INT() PIE1bits.RCIE = 1 - -#define DISABLE_TX_INT() PIE1bits.TXIE = 0 -#define ENABLE_TX_INT() PIE1bits.TXIE = 1 - -#if CLOCKSPEED == 20 -#define DELAY_US(x) { _asm \ - MOVLW x \ - LOOP: \ - NOP \ - NOP \ - DECFSZ WREG, 1, 0 \ - BRA LOOP \ - _endasm } -#endif - -#define setup_timer4(mode, period, postscale) \ - T4CON = (mode | (postscale - 1) << 3); \ - PR4 = period - -#define setup_timer2(mode, period, postscale) \ - T2CON = (mode | (postscale - 1) << 3); \ - PR2 = period - - -/* Global Vars */ -extern uint8_t Piezo_Timer; -extern volatile bool DataPortLocked; - -#endif /* HARDWARE_H */ diff --git a/ports/pic18f97j60/isr.c b/ports/pic18f97j60/isr.c deleted file mode 100644 index 2d4a1dce..00000000 --- a/ports/pic18f97j60/isr.c +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include "stdint.h" -#include "hardware.h" -#include "rs485.h" -#include "bacnet/datalink/dlmstp.h" - -/* from main.c */ -extern volatile uint8_t Milliseconds; - -void InterruptHandlerHigh(void); -void InterruptHandlerLow(void); -void Interrupt_Timer2(void); -void Interrupt_Timer3(void); -void Interrupt_Timer4(void); -void Interrupt_USART_Rx(void); -void Interrupt_USART_Tx(void); -void Interrupt_CCP2(void); -void INT0_Interrupt(void); - -#pragma code InterruptVectorHigh = 0x08 -void InterruptVectorHigh(void) -{ - /* jump to interrupt routine */ - _asm goto InterruptHandlerHigh _endasm -} -#pragma code -#pragma code InterruptVectorLow = 0x18 -void InterruptVectorLow(void) -{ - /* jump to interrupt routine */ - _asm goto InterruptHandlerLow _endasm -} -#pragma code -#pragma interrupt InterruptHandlerHigh -void InterruptHandlerHigh(void) -{ -#if 0 - /* check for USART Rx int */ - if ((PIR1bits.RCIF) && (PIE1bits.RCIE)) { - if ((RCSTA1bits.FERR) || (RCSTA1bits.OERR)) { - Comstat.Rx_Bufferoverrun = TRUE; - PIE1bits.RC1IE = 0; /* Disable Interrupt on receipt */ - } else if (Comstat.Rx_Bytes++ < RX_BUFFER_SIZE - 1) { - Rx_Buffer[Comstat.RxHead++] = RCREG1; - - /* Stick a Null on the end to let us use str functions on our - * buffer */ - Rx_Buffer[Comstat.RxHead] = 0; - } else { - Comstat.Rx_Bufferoverrun = TRUE; - PIE1bits.RC1IE = 0; /* Disable Interrupt on receipt */ - } - } -#endif - - /* check for timer0 int */ - if ((INTCONbits.TMR0IF) && (INTCONbits.TMR0IE)) { - INTCONbits.TMR0IF = 0; - } -} - -#pragma interruptlow InterruptHandlerLow save = PROD, section(".tmpdata"), \ - TABLAT, TBLPTR, section("MATH_DATA") - -void InterruptHandlerLow(void) -{ - /* check for timer2 int */ - if ((PIR1bits.TMR2IF) && (PIE1bits.TMR2IE)) { - PIR1bits.TMR2IF = 0; - Interrupt_Timer2(); - } - - /* check for timer3 int */ - if ((PIR2bits.TMR3IF) && (PIE2bits.TMR3IE)) { - PIR2bits.TMR3IF = 0; - Interrupt_Timer3(); - } - - /* check for timer4 int */ - if ((PIR3bits.TMR4IF) && (PIE3bits.TMR4IE)) { - PIR3bits.TMR4IF = 0; - dlmstp_millisecond_timer(); - Interrupt_Timer4(); - } - - /* check for compare int */ - if ((PIR2bits.CCP2IF) && (PIE2bits.CCP2IE)) { - PIR2bits.CCP2IF = 0; - Interrupt_CCP2(); - } - - /* check for USART Tx int */ - if ((PIR3bits.TX2IF) && (PIE3bits.TX2IE)) { - RS485_Interrupt_Tx(); - } - - /* check for USART Rx int */ - if ((PIR3bits.RC2IF) && (PIE3bits.RC2IE)) { - RS485_Interrupt_Rx(); - } - - /* Unused Interrupts - //check for timer1 int - if ((PIR1bits.TMR1IF) && (PIE1bits.TMR1IE)) - { - PIR1bits.TMR1IF = 0; - Interrupt_Timer1(); - } - - //check for compare int - if ((PIR1bits.CCP1IF) && (PIE1bits.CCP1IE)) - { - PIR1bits.CCP1IF = 0; - Interrupt_CCP1(); - } - - //check for compare int - if ((PIR3bits.CCP3IF) && (PIE3bits.CCP3IE)) - { - PIR3bits.CCP3IF = 0; - Interrupt_CCP3(); - } - - //check for compare int - if ((PIR3bits.CCP4IF) && (PIE3bits.CCP4IE)) - { - PIR3bits.CCP4IF = 0; - - Interrupt_CCP4(); - } - - //check for AD int - if ((PIR1bits.ADIF) && (PIE1bits.ADIE)) - { - PIR1bits.ADIF = 0; - Interrupt_ADC(); - } - - //check for MSSP int - if ((PIR1bits.SSPIF) && (PIE1bits.SSPIE)) - { - PIR1bits.SSPIF = 0; - Interrupt_SSP(); - } - - */ -} - -void Interrupt_Timer2(void) -{ -} - -void Interrupt_Timer3(void) -{ -} - -/* Timer4 is set to go off every 1ms. This is our system tick */ -void Interrupt_Timer4(void) -{ - /* Milisecond is our system tick */ - if (Milliseconds < 0xFF) - ++Milliseconds; -} - -void Interrupt_CCP2(void) -{ -} diff --git a/ports/pic18f97j60/main.c b/ports/pic18f97j60/main.c deleted file mode 100644 index f10d8311..00000000 --- a/ports/pic18f97j60/main.c +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2007 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include /* for memmove */ -#include -#include -#include "stdint.h" -#include "hardware.h" -/* BACnet */ -#include "bacnet/apdu.h" -#include "bacnet/datalink/datalink.h" -#include "bacnet/dcc.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/tsm/tsm.h" -#include "rs485.h" - -/* chip configuration data */ -/* define this to enable ICD */ -/* #define USE_ICD */ - -/* Configuration Bits */ -#pragma config FOSC = HSPLL -#pragma config FOSC2 = ON -#pragma config FCMEN = OFF -#pragma config XINST = OFF -#pragma config IESO = OFF -#pragma config CCP2MX = ON -#pragma config ECCPMX = ON -#pragma config STVR = OFF -#pragma config CP0 = OFF -#pragma config ETHLED = ON - -volatile uint8_t Milliseconds = 0; -volatile uint8_t Zero_Cross_Timeout = 0; - -void Reinitialize(void) -{ - uint8_t i; - char name = 0; - - _asm reset _endasm return; -} - -void Global_Int(enum INT_STATE state) -{ - static uint8_t intstate = 0; - - switch (state) { - case INT_DISABLED: - intstate >>= 2; - intstate |= (INTCON & 0xC0); - break; - case INT_ENABLED: - INTCONbits.GIE = 1; - INTCONbits.PEIE = 1; - intstate <<= 2; - break; - case INT_RESTORE: - INTCON |= (intstate & 0xC0); - intstate <<= 2; - break; - default: - break; - } -} - -void Hardware_Initialize(void) -{ - /* PORTA.0 Input - Photocell PORTA.1 Output - LED Row6 PORTA.2 Output - * - LED Row5 PORTA.3 Output - LED Row4 PORTA.4 Input - Square Wave - * input from RTC PORTA.5 Output - LCD RW */ - TRISA = 0xD1; - - /* PORTB.0 Input - Zero Cross PORTB.1 Input - USB RXF# PORTB.2 Input - * USB TXE# PORTB.3 Output - Keypad Row Enable (74HC373 Output Control) - * PORTB.4 Output Keypad Row Gate (74HC373 Gate) PORTB.5 Output Switch - * Input Latch & Keypad Column Gate (74HC373 Gate) PORTB.6 Input - ICD - * connection PORTB.7 Input - ICD connection */ - TRISB = 0xC7; - - /* PORTC.0 Output - Pilot Latch PORTC.1 Output - Pilot Output Enable - * (low) PORTC.2 I/O - Piezo PORTC.3 Input - I2C clock PORTC.4 Input - * I2C data PORTC.5 Output RS232 enable (low) PORTC.6 Output - RS232 Tx - * PORTC.7 Input - RS232 Rx */ - TRISC = 0x9C; - - /* PORTD.0 I/O - Data bus PORTD.1 I/O - Data bus PORTD.2 I/O - Data - * bus PORTD.3 I/O - Data bus PORTD.4 I/O - Data bus PORTD.5 I/O - Data - * bus PORTD.6 I/O - Data bus PORTD.7 I/O - Data bus */ - TRISD = 0xFF; - - /* PORTE.0 Input - USB RD PORTE.1 Input - USB WR PORTE.2 Output - LCD - * RS PORTE.3 Output - 485 transmit enable PORTE.4 Output - Relay data - * latch PORTE.5 Output Switch Input Clock PORTE.6 Output - Switch - * Input High/Low PORTE.7 Input Switch Input Data */ - TRISE = 0x83; - - /* PORTF.0 Output - LED Row2 PORTF.1 Output - LED Row1 PORTF.2 Output - * - LED Col5 PORTF.3 Output - LED Col4 PORTF.4 Output - LED Col3 - * PORTF.5 Output - LED Col2 PORTF.6 Output - LED Col1 PORTF.7 Output - * LED Col0 */ - TRISF = 0x00; - - /* PORTG.0 Output - 485 receive enable PORTG.1 Output - 485 Tx PORTG.2 - * Input 485 Rx PORTG.3 Output - LCD E PORTG.4 Output - LED Row0 */ - TRISG = 0xE6; - - /* Turn all leds off. These are the hardware pins */ - LED_ROW1 = 1; - LED_ROW2 = 1; - LED_ROW3 = 1; - LED_ROW4 = 1; - LEDPORT = 0x03; - - /* The following gives us a PWM frequency of 1.990KHz with a 50% duty - * cycle It also serves to multiplex the LEDs. */ - CCPR1L = 0x4E; - CCP1CON = 0x2F; - setup_timer2(6, 156, 2); - PIE1bits.TMR2IE = 1; - - /* We will use Timer4 as our system tick timer. Our system tick is set - * to 1ms. Hold off on enabling the int. */ - setup_timer4(5, 250, 5); - - /* Setup our interrupt priorities */ - RCONbits.IPEN = 1; - IPR1 = 0; - IPR2 = 0; - IPR3 = 0; - - /* Setup TMR0 to be high priority */ - INTCON2 = 0xFC; - INTCON3 = 0; - - /* USART 1 high priority */ - IPR1bits.RC1IP = 1; - IPR1bits.TX1IP = 1; - - /* Finally enable our ints */ - Global_Int(INT_ENABLED); -} - -void Initialize_Variables(void) -{ - /* Check to see if we need to initialize our eeproms */ - ENABLE_TIMER4_INT(); - /* interrupts must be enabled before we read our inputs */ - Global_Int(INT_ENABLED); - /* Start our time from now */ - Milliseconds = 0; -} - -void MainTasks(void) -{ - static uint16_t millisecond_counter = 0; - /* Handle our millisecond counters */ - while (Milliseconds) { - millisecond_counter++; - --Milliseconds; - } - /* Handle our seconds counters */ - if (millisecond_counter > 1000) { - millisecond_counter -= 1000; - dcc_timer_seconds(1); - } -} - -void main(void) -{ - RCONbits.NOT_POR = 1; - RCONbits.NOT_RI = 1; - Hardware_Initialize(); - Initialize_Variables(); - /* initialize BACnet Data Link Layer */ - dlmstp_set_my_address(42); - dlmstp_set_max_info_frames(1); - dlmstp_set_max_master(127); - RS485_Set_Baud_Rate(38400); - dlmstp_init(); - /* Handle anything that needs to be done on powerup */ - /* Greet the BACnet world! */ - Send_I_Am(&Handler_Transmit_Buffer[0]); - /* Main loop */ - while (TRUE) { - RESTART_WDT(); - dlmstp_task(); - MainTasks(); - Global_Int(INT_ENABLED); - ENABLE_TIMER4_INT(); - } -} diff --git a/ports/pic18f97j60/mstp.c b/ports/pic18f97j60/mstp.c deleted file mode 100644 index 57d3fb75..00000000 --- a/ports/pic18f97j60/mstp.c +++ /dev/null @@ -1,1250 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2003 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -/* This clause describes a Master-Slave/Token-Passing (MS/TP) data link */ -/* protocol, which provides the same services to the network layer as */ -/* ISO 8802-2 Logical Link Control. It uses services provided by the */ -/* EIA-485 physical layer. Relevant clauses of EIA-485 are deemed to be */ -/* included in this standard by reference. The following hardware is assumed: */ -/* (a) A UART (Universal Asynchronous Receiver/Transmitter) capable of */ -/* transmitting and receiving eight data bits with one stop bit */ -/* and no parity. */ -/* (b) An EIA-485 transceiver whose driver may be disabled. */ -/* (c) A timer with a resolution of five milliseconds or less */ - -#include -#include -#if PRINT_ENABLED -#include -#endif -/* BACnet Stack defines - first */ -#include "bacnet/bacdef.h" -/* BACnet Stack API */ -#include "bacnet/datalink/mstp.h" -#include "bacnet/bacaddr.h" -#if PRINT_ENABLED -#include "bacnet/datalink/mstptext.h" -#endif -/* port specific */ -#include "crc.h" -#include "rs485.h" - -/* debug print statements */ -#if PRINT_ENABLED -#define PRINT_ENABLED_RECEIVE 0 -#define PRINT_ENABLED_RECEIVE_DATA 1 -#define PRINT_ENABLED_MASTER 0 -#else -#define PRINT_ENABLED_RECEIVE 0 -#define PRINT_ENABLED_RECEIVE_DATA 0 -#define PRINT_ENABLED_MASTER 0 -#endif - -/* MS/TP Frame Format */ -/* All frames are of the following format: */ -/* */ -/* Preamble: two octet preamble: X`55', X`FF' */ -/* Frame Type: one octet */ -/* Destination Address: one octet address */ -/* Source Address: one octet address */ -/* Length: two octets, most significant octet first, of the Data field */ -/* Header CRC: one octet */ -/* Data: (present only if Length is non-zero) */ -/* Data CRC: (present only if Length is non-zero) two octets, */ -/* least significant octet first */ -/* (pad): (optional) at most one octet of padding: X'FF' */ - -/* The number of tokens received or used before a Poll For Master cycle */ -/* is executed: 50. */ -#define Npoll 50 - -/* The number of retries on sending Token: 1. */ -#define Nretry_token 1 - -/* The minimum number of DataAvailable or ReceiveError events that must be */ -/* seen by a receiving node in order to declare the line "active": 4. */ -#define Nmin_octets 4 - -/* The minimum time without a DataAvailable or ReceiveError event within */ -/* a frame before a receiving node may discard the frame: 60 bit times. */ -/* (Implementations may use larger values for this timeout, */ -/* not to exceed 100 milliseconds.) */ -/* At 9600 baud, 60 bit times would be about 6.25 milliseconds */ -/* const uint16_t Tframe_abort = 1 + ((1000 * 60) / 9600); */ -#ifndef Tframe_abort -#define Tframe_abort 30 -#endif - -/* The maximum time a node may wait after reception of a frame that expects */ -/* a reply before sending the first octet of a reply or Reply Postponed */ -/* frame: 250 milliseconds. */ -/* note: we always send a reply postponed since a message other than - the reply may be in the transmit queue */ -#ifndef Treply_delay -#define Treply_delay 10 -#endif - -/* The minimum time without a DataAvailable or ReceiveError event */ -/* that a node must wait for a station to begin replying to a */ -/* confirmed request: 255 milliseconds. (Implementations may use */ -/* larger values for this timeout, not to exceed 300 milliseconds.) */ -#ifndef Treply_timeout -#define Treply_timeout 255 -#endif - -/* Repeater turnoff delay. The duration of a continuous logical one state */ -/* at the active input port of an MS/TP repeater after which the repeater */ -/* will enter the IDLE state: 29 bit times < Troff < 40 bit times. */ -#ifndef Troff -#define Troff 30 -#endif - -/* The minimum time without a DataAvailable or ReceiveError event that a */ -/* node must wait for a remote node to begin using a token or replying to */ -/* a Poll For Master frame: 20 milliseconds. (Implementations may use */ -/* larger values for this timeout, not to exceed 100 milliseconds.) */ -#ifndef Tusage_timeout -#define Tusage_timeout 20 -#endif - -/* we need to be able to increment without rolling over */ -#define INCREMENT_AND_LIMIT_UINT8(x) \ - { \ - if (x < 0xFF) \ - x++; \ - } - -bool MSTP_Line_Active(const volatile struct mstp_port_struct_t *mstp_port) -{ - return (mstp_port->EventCount > Nmin_octets); -} - -unsigned MSTP_Create_Frame(uint8_t *buffer, /* where frame is loaded */ - unsigned buffer_len, /* amount of space available */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t *data, /* any data to be sent - may be null */ - unsigned data_len) -{ /* number of bytes of data (up to 501) */ - uint8_t crc8 = 0xFF; /* used to calculate the crc value */ - uint16_t crc16 = 0xFFFF; /* used to calculate the crc value */ - unsigned index = 0; /* used to load the data portion of the frame */ - - /* not enough to do a header */ - if (buffer_len < 8) - return 0; - - buffer[0] = 0x55; - buffer[1] = 0xFF; - buffer[2] = frame_type; - crc8 = CRC_Calc_Header(buffer[2], crc8); - buffer[3] = destination; - crc8 = CRC_Calc_Header(buffer[3], crc8); - buffer[4] = source; - crc8 = CRC_Calc_Header(buffer[4], crc8); - buffer[5] = HI_BYTE(data_len); - crc8 = CRC_Calc_Header(buffer[5], crc8); - buffer[6] = LO_BYTE(data_len); - crc8 = CRC_Calc_Header(buffer[6], crc8); - buffer[7] = ~crc8; - - index = 8; - while (data_len && data && (index < buffer_len)) { - buffer[index] = *data; - crc16 = CRC_Calc_Data(buffer[index], crc16); - data++; - index++; - data_len--; - } - /* append the data CRC if necessary */ - if (index > 8) { - if ((index + 2) <= buffer_len) { - crc16 = ~crc16; - buffer[index] = LO_BYTE(crc16); - index++; - buffer[index] = HI_BYTE(crc16); - index++; - } else - return 0; - } - - return index; /* returns the frame length */ -} - -void MSTP_Create_And_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port to send from */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t *data, /* any data to be sent - may be null */ - unsigned data_len) -{ /* number of bytes of data (up to 501) */ - uint8_t buffer[DLMSTP_MPDU_MAX] = { 0 }; /* buffer for sending */ - uint16_t len = 0; /* number of bytes to send */ - - len = (uint16_t)MSTP_Create_Frame(&buffer[0], /* where frame is loaded */ - sizeof(buffer), /* amount of space available */ - frame_type, /* type of frame to send - see defines */ - destination, /* destination address */ - source, /* source address */ - data, /* any data to be sent - may be null */ - data_len); /* number of bytes of data (up to 501) */ - - RS485_Send_Frame(mstp_port, &buffer[0], len); - /* FIXME: be sure to reset SilenceTimer after each octet is sent! */ -} - -void MSTP_Receive_Frame_FSM(volatile struct mstp_port_struct_t *mstp_port) -{ -#if PRINT_ENABLED_RECEIVE_DATA - static MSTP_RECEIVE_STATE receive_state = MSTP_RECEIVE_STATE_IDLE; -#endif -#if PRINT_ENABLED_RECEIVE - fprintf(stderr, - "MSTP Rx: State=%s Data=%02X hCRC=%02X Index=%u EC=%u DateLen=%u " - "Silence=%u\n", - mstptext_receive_state(mstp_port->receive_state), - mstp_port->DataRegister, mstp_port->HeaderCRC, mstp_port->Index, - mstp_port->EventCount, mstp_port->DataLength, mstp_port->SilenceTimer); -#endif - switch (mstp_port->receive_state) { - /* In the IDLE state, the node waits for the beginning of a frame. - */ - case MSTP_RECEIVE_STATE_IDLE: - /* EatAnError */ - if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "MSTP Rx: %02X ", mstp_port->DataRegister); -#endif - /* Preamble1 */ - if (mstp_port->DataRegister == 0x55) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* receive the remainder of the frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_PREAMBLE; - } - /* EatAnOctet */ - else { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "\n"); -#endif - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the PREAMBLE state, the node waits for the second octet of the - * preamble. */ - case MSTP_RECEIVE_STATE_PREAMBLE: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* a correct preamble has not been received */ - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* Preamble2 */ - if (mstp_port->DataRegister == 0xFF) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->Index = 0; - mstp_port->HeaderCRC = 0xFF; - /* receive the remainder of the frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* ignore RepeatedPreamble1 */ - else if (mstp_port->DataRegister == 0x55) { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the second preamble octet. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_PREAMBLE; - } - /* NotPreamble */ - else { - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the HEADER state, the node waits for the fixed message header. - */ - case MSTP_RECEIVE_STATE_HEADER: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* FrameType */ - if (mstp_port->Index == 0) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->FrameType = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 1; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Destination */ - else if (mstp_port->Index == 1) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DestinationAddress = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 2; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Source */ - else if (mstp_port->Index == 2) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->SourceAddress = mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 3; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Length1 */ - else if (mstp_port->Index == 3) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataLength = mstp_port->DataRegister * 256; - mstp_port->DataAvailable = false; - mstp_port->Index = 4; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* Length2 */ - else if (mstp_port->Index == 4) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataLength += mstp_port->DataRegister; - mstp_port->DataAvailable = false; - mstp_port->Index = 5; - mstp_port->receive_state = MSTP_RECEIVE_STATE_HEADER; - } - /* HeaderCRC */ - else if (mstp_port->Index == 5) { - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - mstp_port->HeaderCRC = CRC_Calc_Header( - mstp_port->DataRegister, mstp_port->HeaderCRC); - mstp_port->DataAvailable = false; - /* don't wait for next state - do it here */ - if (mstp_port->HeaderCRC != 0x55) { - /* BadCRC */ - /* indicate that an error has occurred during the - * reception of a frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else { - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) || - (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS)) { - /* FrameTooLong */ - if (mstp_port->DataLength > DLMSTP_MPDU_MAX) { - /* indicate that a frame with an illegal or */ - /* unacceptable data length has been received */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_IDLE; - } - /* NoData */ - else if (mstp_port->DataLength == 0) { - /* indicate that a frame with no data has been - * received */ - mstp_port->ReceivedValidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_IDLE; - } - /* Data */ - else { - mstp_port->Index = 0; - mstp_port->DataCRC = 0xFFFF; - /* receive the data portion of the frame. */ - mstp_port->receive_state = - MSTP_RECEIVE_STATE_DATA; - } - } - /* NotForUs */ - else { - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - - } - /* not per MS/TP standard, but it is a case not covered */ - else { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - INCREMENT_AND_LIMIT_UINT8(mstp_port->EventCount); - /* indicate that an error has occurred during */ - /* the reception of a frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of a frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - } - break; - /* In the DATA state, the node waits for the data portion of a - * frame. */ - case MSTP_RECEIVE_STATE_DATA: - /* Timeout */ - if (mstp_port->SilenceTimer > Tframe_abort) { - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - /* Error */ - else if (mstp_port->ReceiveError == true) { - mstp_port->ReceiveError = false; - mstp_port->SilenceTimer = 0; - /* indicate that an error has occurred during the reception of a - * frame */ - mstp_port->ReceivedInvalidFrame = true; - /* wait for the start of the next frame. */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } else if (mstp_port->DataAvailable == true) { -#if PRINT_ENABLED_RECEIVE_DATA - fprintf(stderr, "%02X ", mstp_port->DataRegister); -#endif - /* DataOctet */ - if (mstp_port->Index < mstp_port->DataLength) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - mstp_port->InputBuffer[mstp_port->Index] = - mstp_port->DataRegister; - mstp_port->Index++; - mstp_port->receive_state = MSTP_RECEIVE_STATE_DATA; - } - /* CRC1 */ - else if (mstp_port->Index == mstp_port->DataLength) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - mstp_port->Index++; - mstp_port->receive_state = MSTP_RECEIVE_STATE_DATA; - } - /* CRC2 */ - else if (mstp_port->Index == (mstp_port->DataLength + 1)) { - mstp_port->DataCRC = CRC_Calc_Data( - mstp_port->DataRegister, mstp_port->DataCRC); - /* STATE DATA CRC - no need for new state */ - /* indicate the complete reception of a valid frame */ - if (mstp_port->DataCRC == 0xF0B8) - mstp_port->ReceivedValidFrame = true; - else - mstp_port->ReceivedInvalidFrame = true; - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - } - mstp_port->DataAvailable = false; - mstp_port->SilenceTimer = 0; - } - break; - default: - /* shouldn't get here - but if we do... */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - break; - } -#if PRINT_ENABLED_RECEIVE_DATA - if ((receive_state != MSTP_RECEIVE_STATE_IDLE) && - (mstp_port->receive_state == MSTP_RECEIVE_STATE_IDLE)) { - fprintf(stderr, "\n"); - fflush(stderr); - } - receive_state = mstp_port->receive_state; -#endif - - return; -} - -static bool mstp_compare_data_expecting_reply(uint8_t *request_pdu, - uint16_t request_pdu_len, - uint8_t src_address, - uint8_t *reply_pdu, - uint16_t reply_pdu_len, - uint8_t dest_address) -{ - uint16_t offset; - /* One way to check the message is to compare NPDU - src, dest, along with the APDU type, invoke id. - Seems a bit overkill */ - struct DER_compare_t { - BACNET_NPDU_DATA npdu_data; - BACNET_ADDRESS address; - uint8_t pdu_type; - uint8_t invoke_id; - uint8_t service_choice; - }; - struct DER_compare_t request; - struct DER_compare_t reply; - - /* decode the request data */ - request.address.mac[0] = src_address; - request.address.mac_len = 1; - offset = bacnet_npdu_decode(request_pdu, request_pdu_len, NULL, - &request.address, &request.npdu_data); - if (request.npdu_data.network_layer_message) { - return false; - } - request.pdu_type = request_pdu[offset] & 0xF0; - if (request.pdu_type != PDU_TYPE_CONFIRMED_SERVICE_REQUEST) { - return false; - } - request.invoke_id = request_pdu[offset + 2]; - /* segmented message? */ - if (request_pdu[offset] & BIT(3)) - request.service_choice = request_pdu[offset + 5]; - else - request.service_choice = request_pdu[offset + 3]; - /* decode the reply data */ - reply.address.mac[0] = dest_address; - reply.address.mac_len = 1; - offset = bacnet_npdu_decode( - reply_pdu, reply_pdu_len, &reply.address, NULL, &reply.npdu_data); - if (reply.npdu_data.network_layer_message) { - return false; - } - /* reply could be a lot of things: - confirmed, simple ack, abort, reject, error */ - reply.pdu_type = reply_pdu[offset] & 0xF0; - switch (reply.pdu_type) { - case PDU_TYPE_CONFIRMED_SERVICE_REQUEST: - reply.invoke_id = reply_pdu[offset + 2]; - /* segmented message? */ - if (reply_pdu[offset] & BIT(3)) - reply.service_choice = reply_pdu[offset + 5]; - else - reply.service_choice = reply_pdu[offset + 3]; - break; - case PDU_TYPE_SIMPLE_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_COMPLEX_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - /* segmented message? */ - if (reply_pdu[offset] & BIT(3)) - reply.service_choice = reply_pdu[offset + 4]; - else - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_ERROR: - reply.invoke_id = reply_pdu[offset + 1]; - reply.service_choice = reply_pdu[offset + 2]; - break; - case PDU_TYPE_REJECT: - case PDU_TYPE_ABORT: - case PDU_TYPE_SEGMENT_ACK: - reply.invoke_id = reply_pdu[offset + 1]; - break; - default: - return false; - } - if (request.invoke_id != reply.invoke_id) { - return false; - } - /* these services don't have service choice included */ - if ((reply.pdu_type != PDU_TYPE_REJECT) && - (reply.pdu_type != PDU_TYPE_ABORT) && - (reply.pdu_type != PDU_TYPE_SEGMENT_ACK)) { - if (request.service_choice != reply.service_choice) { - return false; - } - } - if (request.npdu_data.protocol_version != - reply.npdu_data.protocol_version) { - return false; - } - if (request.npdu_data.priority != reply.npdu_data.priority) { - return false; - } - if (!bacnet_address_same(&request.address, &reply.address)) { - return false; - } - - return true; -} - -/* returns true if we need to transition immediately */ -bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port) -{ - int mtu_len = 0; - int frame_type = 0; - uint8_t next_poll_station = 0; - uint8_t next_this_station = 0; - uint8_t next_next_station = 0; - uint16_t my_timeout = 10, ns_timeout = 0; - /* transition immediately to the next state */ - bool transition_now = false; - bool matched = false; -#if PRINT_ENABLED_MASTER - static MSTP_MASTER_STATE master_state = MSTP_MASTER_STATE_INITIALIZE; -#endif - - /* some calculations that several states need */ - next_poll_station = - (mstp_port->Poll_Station + 1) % (mstp_port->Nmax_master + 1); - next_this_station = - (mstp_port->This_Station + 1) % (mstp_port->Nmax_master + 1); - next_next_station = - (mstp_port->Next_Station + 1) % (mstp_port->Nmax_master + 1); -#if PRINT_ENABLED_MASTER - if (mstp_port->master_state != master_state) { - master_state = mstp_port->master_state; - fprintf(stderr, - "MSTP: TS=%02X[%02X] NS=%02X[%02X] PS=%02X[%02X] EC=%u TC=%u ST=%u " - "%s\n", - mstp_port->This_Station, next_this_station, mstp_port->Next_Station, - next_next_station, mstp_port->Poll_Station, next_poll_station, - mstp_port->EventCount, mstp_port->TokenCount, - mstp_port->SilenceTimer, - mstptext_master_state(mstp_port->master_state)); - } -#endif - - switch (mstp_port->master_state) { - case MSTP_MASTER_STATE_INITIALIZE: - /* DoneInitializing */ - /* indicate that the next station is unknown */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->Poll_Station = mstp_port->This_Station; - /* cause a Poll For Master to be sent when this node first */ - /* receives the token */ - mstp_port->TokenCount = Npoll; - mstp_port->SoleMaster = false; - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - break; - /* In the IDLE state, the node waits for a frame. */ - case MSTP_MASTER_STATE_IDLE: - /* LostToken */ - if (mstp_port->SilenceTimer >= Tno_token) { - /* assume that the token has been lost */ - mstp_port->EventCount = 0; /* Addendum 135-2004d-8 */ - mstp_port->master_state = MSTP_MASTER_STATE_NO_TOKEN; - /* set the receive frame flags to false in case we received - some bytes and had a timeout for some reason */ - mstp_port->ReceivedInvalidFrame = false; - mstp_port->ReceivedValidFrame = false; - transition_now = true; - } - /* ReceivedInvalidFrame */ - else if (mstp_port->ReceivedInvalidFrame == true) { - /* invalid frame was received */ - mstp_port->ReceivedInvalidFrame = false; - /* wait for the next frame - remain in IDLE */ - } else if (mstp_port->ReceivedValidFrame == true) { -#if PRINT_ENABLED_MASTER - fprintf(stderr, - "MSTP: ReceivedValidFrame Src=%02X Dest=%02X DataLen=%u " - "FC=%u ST=%u Type=%s\n", - mstp_port->SourceAddress, mstp_port->DestinationAddress, - mstp_port->DataLength, mstp_port->FrameCount, - mstp_port->SilenceTimer, - mstptext_frame_type(mstp_port->FrameType)); -#endif - /* destined for me! */ - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) || - (mstp_port->DestinationAddress == MSTP_BROADCAST_ADDRESS)) { - switch (mstp_port->FrameType) { - /* ReceivedToken */ - case FRAME_TYPE_TOKEN: - /* tokens can't be broadcast */ - if (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) - break; - mstp_port->ReceivedValidFrame = false; - mstp_port->FrameCount = 0; - mstp_port->SoleMaster = false; - mstp_port->master_state = - MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - break; - /* ReceivedPFM */ - case FRAME_TYPE_POLL_FOR_MASTER: - /* DestinationAddress is equal to TS */ - if (mstp_port->DestinationAddress == - mstp_port->This_Station) { - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER, - mstp_port->SourceAddress, - mstp_port->This_Station, NULL, 0); - } - break; - case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY: - if ((mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) && - (npdu_confirmed_service(mstp_port->InputBuffer, - mstp_port->DataLength))) { - /* BTL test: verifies that the IUT will quietly - discard any Confirmed-Request-PDU, whose - destination address is a multicast or - broadcast address, received from the - network layer. */ - } else { - /* indicate successful reception to the higher - * layers */ - dlmstp_put_receive(mstp_port->SourceAddress, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - } - break; - case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: - if (mstp_port->DestinationAddress == - MSTP_BROADCAST_ADDRESS) { - /* broadcast DER just remains IDLE */ - } else { - /* indicate successful reception to the higher - * layers */ - dlmstp_put_receive(mstp_port->SourceAddress, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - mstp_port->master_state = - MSTP_MASTER_STATE_ANSWER_DATA_REQUEST; - } - break; - case FRAME_TYPE_TEST_REQUEST: - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_TEST_RESPONSE, - mstp_port->SourceAddress, - mstp_port->This_Station, - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - break; - case FRAME_TYPE_TEST_RESPONSE: - default: - break; - } - } - mstp_port->ReceivedValidFrame = false; - } - break; - /* In the USE_TOKEN state, the node is allowed to send one or */ - /* more data frames. These may be BACnet Data frames or */ - /* proprietary frames. */ - case MSTP_MASTER_STATE_USE_TOKEN: - if (!mstp_port->TxReady) { - /* NothingToSend */ - mstp_port->FrameCount = mstp_port->Nmax_info_frames; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - transition_now = true; - } else { - uint8_t destination = mstp_port->TxBuffer[3]; - RS485_Send_Frame(mstp_port, (uint8_t *)&mstp_port->TxBuffer[0], - mstp_port->TxLength); - mstp_port->FrameCount++; - switch (mstp_port->TxFrameType) { - case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: - /* SendAndWait */ - if (destination == MSTP_BROADCAST_ADDRESS) - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - else - mstp_port->master_state = - MSTP_MASTER_STATE_WAIT_FOR_REPLY; - break; - case FRAME_TYPE_TEST_REQUEST: - mstp_port->master_state = - MSTP_MASTER_STATE_WAIT_FOR_REPLY; - break; - case FRAME_TYPE_TEST_RESPONSE: - case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY: - default: - /* SendNoWait */ - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - } - mstp_port->TxReady = false; - } - break; - /* In the WAIT_FOR_REPLY state, the node waits for */ - /* a reply from another node. */ - case MSTP_MASTER_STATE_WAIT_FOR_REPLY: - if (mstp_port->SilenceTimer >= Treply_timeout) { - /* ReplyTimeout */ - /* assume that the request has failed */ - mstp_port->FrameCount = mstp_port->Nmax_info_frames; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - /* Any retry of the data frame shall await the next entry */ - /* to the USE_TOKEN state. (Because of the length of the - * timeout, */ - /* this transition will cause the token to be passed regardless - */ - /* of the initial value of FrameCount.) */ - transition_now = true; - } else { - if (mstp_port->ReceivedInvalidFrame == true) { - /* InvalidFrame */ - /* error in frame reception */ - mstp_port->ReceivedInvalidFrame = false; - mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; - transition_now = true; - } else if (mstp_port->ReceivedValidFrame == true) { - if (mstp_port->DestinationAddress == - mstp_port->This_Station) { - switch (mstp_port->FrameType) { - case FRAME_TYPE_REPLY_POSTPONED: - /* ReceivedReplyPostponed */ - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - case FRAME_TYPE_TEST_RESPONSE: - mstp_port->master_state = - MSTP_MASTER_STATE_IDLE; - break; - case FRAME_TYPE_TOKEN: - case FRAME_TYPE_POLL_FOR_MASTER: - case FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER: - case FRAME_TYPE_TEST_REQUEST: - /* ReceivedUnexpectedFrame */ - /* FrameType has a value other than a FrameType - known to this node that indicates a reply */ - mstp_port->master_state = - MSTP_MASTER_STATE_IDLE; - break; - default: - /* ReceivedReply */ - /* FrameType known to this node that - indicates a reply */ - /* indicate successful reception - to the higher layers */ - dlmstp_put_receive( - mstp_port->SourceAddress, /* source MS/TP - address */ - (uint8_t *)&mstp_port->InputBuffer[0], - mstp_port->DataLength); - mstp_port->master_state = - MSTP_MASTER_STATE_DONE_WITH_TOKEN; - break; - } - } else { - /* ReceivedUnexpectedFrame */ - /* an unexpected frame was received */ - /* This may indicate the presence of multiple tokens. */ - /* Synchronize with the network. */ - /* This action drops the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } - mstp_port->ReceivedValidFrame = false; - transition_now = true; - } - } - break; - /* The DONE_WITH_TOKEN state either sends another data frame, */ - /* passes the token, or initiates a Poll For Master cycle. */ - case MSTP_MASTER_STATE_DONE_WITH_TOKEN: - /* SendAnotherFrame */ - if (mstp_port->FrameCount < mstp_port->Nmax_info_frames) { - /* then this node may send another information frame */ - /* before passing the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else if ((mstp_port->SoleMaster == false) && - (mstp_port->Next_Station == mstp_port->This_Station)) { - /* NextStationUnknown - added in Addendum 135-2008v-1 */ - /* then the next station to which the token - should be sent is unknown - so PollForMaster */ - mstp_port->Poll_Station = next_this_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - /* Npoll changed in Errata SSPC-135-2004 */ - else if (mstp_port->TokenCount < (Npoll - 1)) { - if ((mstp_port->SoleMaster == true) && - (mstp_port->Next_Station != next_this_station)) { - /* SoleMaster */ - /* there are no other known master nodes to */ - /* which the token may be sent (true master-slave - * operation). */ - mstp_port->FrameCount = 0; - mstp_port->TokenCount++; - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else { - /* SendToken */ - /* Npoll changed in Errata SSPC-135-2004 */ - /* The comparison of NS and TS+1 eliminates the Poll For - * Master */ - /* if there are no addresses between TS and NS, since there - * is no */ - /* address at which a new master node may be found in that - * case. */ - mstp_port->TokenCount++; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->RetryCount = 0; - mstp_port->EventCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } - } else if (next_poll_station == mstp_port->Next_Station) { - if (mstp_port->SoleMaster == true) { - /* SoleMasterRestartMaintenancePFM */ - mstp_port->Poll_Station = next_next_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* no known successor node */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = - 1; /* changed in Errata SSPC-135-2004 */ - /* mstp_port->EventCount = 0; removed in Addendum - * 135-2004d-8 */ - /* find a new successor to TS */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } else { - /* ResetMaintenancePFM */ - mstp_port->Poll_Station = mstp_port->This_Station; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->RetryCount = 0; - mstp_port->TokenCount = - 1; /* changed in Errata SSPC-135-2004 */ - mstp_port->EventCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } - } else { - /* SendMaintenancePFM */ - mstp_port->Poll_Station = next_poll_station; - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - break; - /* The PASS_TOKEN state listens for a successor to begin using */ - /* the token that this node has just attempted to pass. */ - case MSTP_MASTER_STATE_PASS_TOKEN: - if (mstp_port->SilenceTimer < Tusage_timeout) { - if (mstp_port->EventCount > Nmin_octets) { - /* SawTokenUser */ - /* Assume that a frame has been sent by the new token user. - */ - /* Enter the IDLE state to process the frame. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - } else { - if (mstp_port->RetryCount < Nretry_token) { - /* RetrySendToken */ - mstp_port->RetryCount++; - /* Transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->EventCount = 0; - /* re-enter the current state to listen for NS */ - /* to begin using the token. */ - } else { - /* FindNewSuccessor */ - /* Assume that NS has failed. */ - /* note: if NS=TS-1, this node could send PFM to self! */ - mstp_port->Poll_Station = next_next_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* no known successor node */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = 0; - /* mstp_port->EventCount = 0; removed in Addendum - * 135-2004d-8 */ - /* find a new successor to TS */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - } - break; - /* The NO_TOKEN state is entered if mstp_port->SilenceTimer becomes - * greater */ - /* than Tno_token, indicating that there has been no network - * activity */ - /* for that period of time. The timeout is continued to determine */ - /* whether or not this node may create a token. */ - case MSTP_MASTER_STATE_NO_TOKEN: - my_timeout = Tno_token + (Tslot * mstp_port->This_Station); - if (mstp_port->SilenceTimer < my_timeout) { - if (mstp_port->EventCount > Nmin_octets) { - /* SawFrame */ - /* Some other node exists at a lower address. */ - /* Enter the IDLE state to receive and process the incoming - * frame. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - } else { - ns_timeout = - Tno_token + (Tslot * (mstp_port->This_Station + 1)); - if (mstp_port->SilenceTimer < ns_timeout) { - /* GenerateToken */ - /* Assume that this node is the lowest numerical address */ - /* on the network and is empowered to create a token. */ - mstp_port->Poll_Station = next_this_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - /* indicate that the next station is unknown */ - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->RetryCount = 0; - mstp_port->TokenCount = 0; - /* mstp_port->EventCount = 0; removed Addendum 135-2004d-8 - */ - /* enter the POLL_FOR_MASTER state to find a new successor - * to TS. */ - mstp_port->master_state = MSTP_MASTER_STATE_POLL_FOR_MASTER; - } - } - break; - /* In the POLL_FOR_MASTER state, the node listens for a reply to */ - /* a previously sent Poll For Master frame in order to find */ - /* a successor node. */ - case MSTP_MASTER_STATE_POLL_FOR_MASTER: - if (mstp_port->ReceivedValidFrame == true) { - if ((mstp_port->DestinationAddress == - mstp_port->This_Station) && - (mstp_port->FrameType == - FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER)) { - /* ReceivedReplyToPFM */ - mstp_port->SoleMaster = false; - mstp_port->Next_Station = mstp_port->SourceAddress; - mstp_port->EventCount = 0; - /* Transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, NULL, - 0); - mstp_port->Poll_Station = mstp_port->This_Station; - mstp_port->TokenCount = 0; - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } else { - /* ReceivedUnexpectedFrame */ - /* An unexpected frame was received. */ - /* This may indicate the presence of multiple tokens. */ - /* enter the IDLE state to synchronize with the network. */ - /* This action drops the token. */ - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - transition_now = true; - } - mstp_port->ReceivedValidFrame = false; - } else if ((mstp_port->SilenceTimer >= Tusage_timeout) || - (mstp_port->ReceivedInvalidFrame == true)) { - if (mstp_port->SoleMaster == true) { - /* SoleMaster */ - /* There was no valid reply to the periodic poll */ - /* by the sole known master for other masters. */ - mstp_port->FrameCount = 0; - /* mstp_port->TokenCount++; removed in 2004 */ - mstp_port->master_state = MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } else { - if (mstp_port->Next_Station != mstp_port->This_Station) { - /* DoneWithPFM */ - /* There was no valid reply to the maintenance */ - /* poll for a master at address PS. */ - mstp_port->EventCount = 0; - /* transmit a Token frame to NS */ - MSTP_Create_And_Send_Frame(mstp_port, FRAME_TYPE_TOKEN, - mstp_port->Next_Station, mstp_port->This_Station, - NULL, 0); - mstp_port->RetryCount = 0; - mstp_port->master_state = MSTP_MASTER_STATE_PASS_TOKEN; - } else { - if (next_poll_station != mstp_port->This_Station) { - /* SendNextPFM */ - mstp_port->Poll_Station = next_poll_station; - /* Transmit a Poll For Master frame to PS. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_POLL_FOR_MASTER, - mstp_port->Poll_Station, - mstp_port->This_Station, NULL, 0); - mstp_port->RetryCount = 0; - /* Re-enter the current state. */ - } else { - /* DeclareSoleMaster */ - /* to indicate that this station is the only master - */ - mstp_port->SoleMaster = true; - mstp_port->FrameCount = 0; - mstp_port->master_state = - MSTP_MASTER_STATE_USE_TOKEN; - transition_now = true; - } - } - } - mstp_port->ReceivedInvalidFrame = false; - } - break; - /* The ANSWER_DATA_REQUEST state is entered when a */ - /* BACnet Data Expecting Reply, a Test_Request, or */ - /* a proprietary frame that expects a reply is received. */ - case MSTP_MASTER_STATE_ANSWER_DATA_REQUEST: - if (mstp_port->TxReady) { - /* Compare the APDU type received and - see if the message is that same APDU type - along with the matching src/dest and invoke ID */ - matched = mstp_compare_data_expecting_reply( - &mstp_port->InputBuffer[0], mstp_port->DataLength, - mstp_port->SourceAddress, &mstp_port->TxBuffer[8], - mstp_port->TxLength, mstp_port->TxDestination); - } - if (matched && mstp_port->TxReady) { - /* Reply */ - /* If a reply is available from the higher layers */ - /* within Treply_delay after the reception of the */ - /* final octet of the requesting frame */ - /* (the mechanism used to determine this is a local matter), */ - /* then call MSTP_Create_And_Send_Frame to transmit the reply - * frame */ - /* and enter the IDLE state to wait for the next frame. */ - RS485_Send_Frame(mstp_port, (uint8_t *)&mstp_port->TxBuffer[0], - mstp_port->TxLength); - mstp_port->TxReady = false; - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } else if (mstp_port->SilenceTimer > Treply_delay) { - /* DeferredReply */ - /* If no reply will be available from the higher layers */ - /* within Treply_delay after the reception of the */ - /* final octet of the requesting frame (the mechanism */ - /* used to determine this is a local matter), */ - /* then an immediate reply is not possible. */ - /* Any reply shall wait until this node receives the token. */ - /* Call MSTP_Create_And_Send_Frame to transmit a */ - /* Reply Postponed frame, and enter the IDLE state. */ - MSTP_Create_And_Send_Frame(mstp_port, - FRAME_TYPE_REPLY_POSTPONED, mstp_port->SourceAddress, - mstp_port->This_Station, NULL, 0); - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - } - break; - default: - mstp_port->master_state = MSTP_MASTER_STATE_IDLE; - break; - } - - return transition_now; -} - -/* note: This_Station should be set with the MAC address */ -/* note: Nmax_info_frames should be set */ -/* note: Nmax_master should be set */ -void MSTP_Init(volatile struct mstp_port_struct_t *mstp_port) -{ - int i; /*loop counter */ - - if (mstp_port) { - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - mstp_port->master_state = MSTP_MASTER_STATE_INITIALIZE; - mstp_port->ReceiveError = false; - mstp_port->DataAvailable = false; - mstp_port->DataRegister = 0; - mstp_port->DataCRC = 0; - mstp_port->DataCRC = 0; - mstp_port->DataLength = 0; - mstp_port->DestinationAddress = 0; - mstp_port->EventCount = 0; - mstp_port->FrameType = FRAME_TYPE_TOKEN; - mstp_port->FrameCount = 0; - mstp_port->HeaderCRC = 0; - mstp_port->Index = 0; - mstp_port->Index = 0; - for (i = 0; i < sizeof(mstp_port->InputBuffer); i++) { - mstp_port->InputBuffer[i] = 0; - } - mstp_port->Next_Station = mstp_port->This_Station; - mstp_port->Poll_Station = mstp_port->This_Station; - mstp_port->ReceivedInvalidFrame = false; - mstp_port->ReceivedValidFrame = false; - mstp_port->RetryCount = 0; - mstp_port->SilenceTimer = 0; - /* mstp_port->ReplyPostponedTimer = 0; */ - mstp_port->SoleMaster = false; - mstp_port->SourceAddress = 0; - mstp_port->TokenCount = 0; -#if 0 - /* these are adjustable, so should already be set */ - mstp_port->Nmax_info_frames = DEFAULT_MAX_INFO_FRAMES; - mstp_port->Nmax_master = DEFAULT_MAX_MASTER; -#endif - - /* An array of octets, used to store PDU octets prior to being - * transmitted. */ - /* This array is only used for APDU messages */ - for (i = 0; i < sizeof(mstp_port->TxBuffer); i++) { - mstp_port->TxBuffer[i] = 0; - } - mstp_port->TxLength = 0; - mstp_port->TxReady = false; - mstp_port->TxFrameType = 0; - } -} diff --git a/ports/pic18f97j60/mstp.h b/ports/pic18f97j60/mstp.h deleted file mode 100644 index e0a1c7ab..00000000 --- a/ports/pic18f97j60/mstp.h +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2004 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef MSTP_H -#define MSTP_H - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/datalink/mstpdef.h" -#include "bacnet/datalink/dlmstp.h" - -struct mstp_port_struct_t { - MSTP_RECEIVE_STATE receive_state; - /* When a master node is powered up or reset, */ - /* it shall unconditionally enter the INITIALIZE state. */ - MSTP_MASTER_STATE master_state; - /* A Boolean flag set to TRUE by the Receive State Machine */ - /* if an error is detected during the reception of a frame. */ - /* Set to FALSE by the main state machine. */ - unsigned ReceiveError:1; - /* There is data in the buffer */ - unsigned DataAvailable:1; - unsigned ReceivedInvalidFrame:1; - /* A Boolean flag set to TRUE by the Receive State Machine */ - /* if a valid frame is received. */ - /* Set to FALSE by the main state machine. */ - unsigned ReceivedValidFrame:1; - /* A Boolean flag set to TRUE by the master machine if this node is the */ - /* only known master node. */ - unsigned SoleMaster:1; - /* stores the latest received data */ - uint8_t DataRegister; - /* Used to accumulate the CRC on the data field of a frame. */ - uint16_t DataCRC; - /* Used to store the data length of a received frame. */ - unsigned DataLength; - /* Used to store the destination address of a received frame. */ - uint8_t DestinationAddress; - /* Used to count the number of received octets or errors. */ - /* This is used in the detection of link activity. */ - /* Compared to Nmin_octets */ - uint8_t EventCount; - /* Used to store the frame type of a received frame. */ - uint8_t FrameType; - /* The number of frames sent by this node during a single token hold. */ - /* When this counter reaches the value Nmax_info_frames, the node must */ - /* pass the token. */ - unsigned FrameCount; - /* Used to accumulate the CRC on the header of a frame. */ - uint8_t HeaderCRC; - /* Used as an index by the Receive State Machine, up to a maximum value of */ - /* InputBufferSize. */ - unsigned Index; - /* An array of octets, used to store octets as they are received. */ - /* InputBuffer is indexed from 0 to InputBufferSize-1. */ - /* The maximum size of a frame is 501 octets. */ - uint8_t *InputBuffer; - /* "Next Station," the MAC address of the node to which This Station passes */ - /* the token. If the Next_Station is unknown, Next_Station shall be equal to */ - /* This_Station. */ - uint8_t Next_Station; - /* "Poll Station," the MAC address of the node to which This Station last */ - /* sent a Poll For Master. This is used during token maintenance. */ - uint8_t Poll_Station; - /* A counter of transmission retries used for Token and Poll For Master */ - /* transmission. */ - unsigned RetryCount; - /* A timer with nominal 5 millisecond resolution used to measure and */ - /* generate silence on the medium between octets. It is incremented by a */ - /* timer process and is cleared by the Receive State Machine when activity */ - /* is detected and by the SendFrame procedure as each octet is transmitted. */ - /* Since the timer resolution is limited and the timer is not necessarily */ - /* synchronized to other machine events, a timer value of N will actually */ - /* denote intervals between N-1 and N */ - uint16_t SilenceTimer; - - /* A timer used to measure and generate Reply Postponed frames. It is */ - /* incremented by a timer process and is cleared by the Master Node State */ - /* Machine when a Data Expecting Reply Answer activity is completed. */ -/* note: we always send a reply postponed since a message other than - the reply may be in the transmit queue */ -/* uint16_t ReplyPostponedTimer; */ - - /* Used to store the Source Address of a received frame. */ - uint8_t SourceAddress; - - /* The number of tokens received by this node. When this counter reaches the */ - /* value Npoll, the node polls the address range between TS and NS for */ - /* additional master nodes. TokenCount is set to zero at the end of the */ - /* polling process. */ - unsigned TokenCount; - - /* "This Station," the MAC address of this node. TS is generally read from a */ - /* hardware DIP switch, or from nonvolatile memory. Valid values for TS are */ - /* 0 to 254. The value 255 is used to denote broadcast when used as a */ - /* destination address but is not allowed as a value for TS. */ - uint8_t This_Station; - - /* This parameter represents the value of the Max_Info_Frames property of */ - /* the node's Device object. The value of Max_Info_Frames specifies the */ - /* maximum number of information frames the node may send before it must */ - /* pass the token. Max_Info_Frames may have different values on different */ - /* nodes. This may be used to allocate more or less of the available link */ - /* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */ - /* node, its value shall be 1. */ - unsigned Nmax_info_frames; - - /* This parameter represents the value of the Max_Master property of the */ - /* node's Device object. The value of Max_Master specifies the highest */ - /* allowable address for master nodes. The value of Max_Master shall be */ - /* less than or equal to 127. If Max_Master is not writable in a node, */ - /* its value shall be 127. */ - unsigned Nmax_master; - - /* An array of octets, used to store PDU octets prior to being transmitted. */ - /* This array is only used for APDU messages */ - uint8_t TxBuffer[DLMSTP_MPDU_MAX]; - unsigned TxLength; - uint8_t TxDestination; - bool TxReady; /* true if ready to be sent or received */ - uint8_t TxFrameType; /* type of message - needed by MS/TP */ -}; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void MSTP_Init( - volatile struct mstp_port_struct_t *mstp_port); - void MSTP_Receive_Frame_FSM( - volatile struct mstp_port_struct_t - *mstp_port); - bool MSTP_Master_Node_FSM( - volatile struct mstp_port_struct_t - *mstp_port); - - /* returns true if line is active */ - bool MSTP_Line_Active( - const volatile struct mstp_port_struct_t *mstp_port); - - unsigned MSTP_Create_Frame( - uint8_t * buffer, /* where frame is loaded */ - unsigned buffer_len, /* amount of space available */ - uint8_t frame_type, /* type of frame to send - see defines */ - uint8_t destination, /* destination address */ - uint8_t source, /* source address */ - const uint8_t * data, /* any data to be sent - may be null */ - unsigned data_len); /* number of bytes of data (up to 501) */ - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f97j60/readme.txt b/ports/pic18f97j60/readme.txt deleted file mode 100644 index 83d95e21..00000000 --- a/ports/pic18f97j60/readme.txt +++ /dev/null @@ -1,42 +0,0 @@ -BACnet Stack - SourceForge.net -Build for MPLAB IDE - -These are some settings that are important when building -the BACnet Stack using MPLAB IDE and MCC18 Compiler, - -1. Add the files to the project that you need: -abort.c, apdu.c, bacapp.c, bacdcode.c, bacerror.c, -bacstr.c, crc.c, datetime.c, dcc.c, iam.c, -npdu.c, rd.c, reject.c, rp.c, whois.c, wp.c - -From ports/picxx: isr.c, main.c, rs485.c, mstp.c, dlmstp.c - -From demo/object/: device.c or dev_tiny.c -objects as needed: ai.c, ao.c, etc. - -From demo/handler/: txbuf.c, h_dcc.c, h_rd.c, h_rp.c or h_rp_tiny.c -Additional handlers as needed: h_wp.c - -2. Project->Options->Project - -General Tab: Include Path: -C:\code\bacnet-stack\;C:\code\bacnet-stack\demo\handler\;C:\code\bacnet-stack\demo\object\;C:\code\bacnet-stack\ports\pic18f6720\ - -MPLAB C18 Tab: Memory Model: -Code: Large Code Model -Data: Large Data Model -Stack: Multi-bank Model - -MPLAB C18 Tab: General: Macro Definitions: -PRINT_ENABLED=0 -BACDL_MSTP=1 -TSM_ENABLED=0 - -3. The linker script must reserve some extra stack space. - -//DATABANK NAME=gpr12 START=0xC00 END=0xCFF -//DATABANK NAME=gpr13 START=0xD00 END=0xDFF -DATABANK NAME=stackreg START=0xC00 END=0xDFF PROTECTED - -//STACK SIZE=0x100 RAM=gpr13 -STACK SIZE=0x200 RAM=stackreg diff --git a/ports/pic18f97j60/rs485.c b/ports/pic18f97j60/rs485.c deleted file mode 100644 index afab7382..00000000 --- a/ports/pic18f97j60/rs485.c +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* The module handles sending data out the RS-485 port */ -/* and handles receiving data from the RS-485 port. */ -/* Customize this file for your specific hardware */ -#include -#include -#include -#include -#include "hardware.h" -#include "bacnet/datalink/mstp.h" -#include "rs485.h" -#include "bacnet/basic/sys/fifo.h" - -/* public port info */ -extern volatile struct mstp_port_struct_t MSTP_Port; - -/* the baud rate is adjustable */ -uint32_t RS485_Baud_Rate = 38400; - -/* the FIFO structures for sending and receiving */ -FIFO_BUFFER FIFO_Rx; -FIFO_BUFFER FIFO_Tx; -#pragma udata MSTPPortData -/* the buffer for receiving data (size must be a power of 2) */ -volatile uint8_t RS485_Rx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)]; -/* the buffer for sending data (size must be a power of 2) */ -volatile uint8_t RS485_Tx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)]; -#pragma udata - -/**************************************************************************** - * DESCRIPTION: Transmits a frame using the UART - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port specific data */ - const uint8_t *buffer, /* frame to send (up to 501 bytes of data) */ - uint16_t nbytes) -{ /* number of bytes of data (up to 501) */ - uint16_t i = 0; /* loop counter */ - uint8_t turnaround_time; - - if (!buffer) - return; - - while (!FIFO_Empty(&FIFO_Tx)) { - /* buffer is not empty. Wait for ISR to transmit. */ - }; - - /* wait 40 bit times since reception */ - if (RS485_Baud_Rate == 9600) - turnaround_time = 4; - else if (RS485_Baud_Rate == 19200) - turnaround_time = 2; - else - turnaround_time = 2; - - while (mstp_port->SilenceTimer < turnaround_time) { - /* The line has not been silent long enough, so wait. */ - }; - - if (FIFO_Add(&FIFO_Tx, buffer, nbytes)) { - /* disable the receiver */ - PIE3bits.RC2IE = 0; - RCSTA2bits.CREN = 0; - /* enable the transceiver */ - RS485_TX_ENABLE = 1; - RS485_RX_DISABLE = 1; - /* enable the transmitter */ - TXSTA2bits.TXEN = 1; - PIE3bits.TX2IE = 1; - /* reset the silence timer per MSTP spec, sort of */ - mstp_port->SilenceTimer = 0; - } - - return; -} - -/**************************************************************************** - * DESCRIPTION: Checks for data on the receive UART, and handles errors - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -bool RS485_Check_UART_Data(volatile struct mstp_port_struct_t *mstp_port) -{ - /* check for data */ - if (!FIFO_Empty(&FIFO_Rx)) { - mstp_port->DataRegister = FIFO_Get(&FIFO_Rx); - mstp_port->DataAvailable = TRUE; - } - - return (!FIFO_Empty(&FIFO_Rx)); -} - -/* ************************************************************************* - DESCRIPTION: Receives RS485 data stream - - RETURN: none - - ALGORITHM: none - - NOTES: none - *************************************************************************** */ -void RS485_Interrupt_Rx(void) -{ - uint8_t data_byte; - - if ((RCSTA2bits.FERR) || (RCSTA2bits.OERR)) { - /* Clear the error */ - RCSTA2bits.CREN = 0; - RCSTA2bits.CREN = 1; - /* FIXME: flag the MS/TP state machine on buffer overrun */ - data_byte = RCREG2; - } else { - data_byte = RCREG2; - FIFO_Put(&FIFO_Rx, data_byte); - } -} - -/* ************************************************************************* - DESCRIPTION: Transmits a byte using the UART out the RS485 port - - RETURN: none - - ALGORITHM: none - - NOTES: none - *************************************************************************** */ -void RS485_Interrupt_Tx(void) -{ - if (!FIFO_Empty(&FIFO_Tx)) { - TXREG2 = FIFO_Get(&FIFO_Tx); - } else { - /* wait for the USART to be empty */ - while (!TXSTA2bits.TRMT) - ; - /* disable this interrupt */ - PIE3bits.TX2IE = 0; - /* enable the receiver */ - RS485_TX_ENABLE = 0; - RS485_RX_DISABLE = 0; - /* enable the this interrupt */ - PIE3bits.RC2IE = 1; - RCSTA2bits.CREN = 1; - } -} - -/**************************************************************************** - * DESCRIPTION: Returns the baud rate that we are currently running at - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -uint32_t RS485_Get_Baud_Rate(void) -{ - return RS485_Baud_Rate; -} - -/**************************************************************************** - * DESCRIPTION: Sets the baud rate for the chip USART - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -bool RS485_Set_Baud_Rate(uint32_t baud) -{ - bool valid = true; - - switch (baud) { - case 9600: - case 19200: - case 38400: - case 57600: - case 76800: - case 115200: - RS485_Baud_Rate = baud; - break; - default: - valid = false; - break; - } - - if (valid) { - /* FIXME: store the baud rate */ - /* I2C_Write_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&RS485_Baud_Rate, - sizeof(RS485_Baud_Rate), - EEPROM_MSTP_BAUD_RATE_ADDR); */ - } - - return valid; -} - -/**************************************************************************** - * DESCRIPTION: Initializes the RS485 hardware and variables, and starts in - * receive mode. - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Initialize_Port(void) -{ - /* Reset USART registers to POR state */ - TXSTA2 = 0; - RCSTA2 = 0; - /* configure USART for receiving */ - /* since the TX will handle setting up for transmit */ - RCSTA2bits.CREN = 1; - /* Interrupt on receipt */ - PIE3bits.RC2IE = 1; - /* enable the transmitter, disable its interrupt */ - TXSTA2bits.TXEN = 1; - PIE3bits.TX2IE = 0; - /* setup USART Baud Rate Generator */ - /* see BAUD RATES FOR ASYNCHRONOUS MODE in Data Book */ - /* Fosc=20MHz - BRGH=1 BRGH=0 - Rate SPBRG Rate SPBRG - ------- ----- ------- ----- - 9615 129 9469 32 - 19230 64 19530 15 - 37878 32 78130 3 - 56818 21 104200 2 - 113630 10 312500 0 - 250000 4 - 625000 1 - 1250000 0 - */ - switch (RS485_Baud_Rate) { - case 19200: - SPBRG2 = 64; - TXSTA2bits.BRGH = 1; - break; - case 38400: - SPBRG2 = 32; - TXSTA2bits.BRGH = 1; - break; - case 57600: - SPBRG2 = 21; - TXSTA2bits.BRGH = 1; - break; - case 76800: - SPBRG2 = 3; - TXSTA2bits.BRGH = 0; - break; - case 115200: - SPBRG2 = 10; - TXSTA2bits.BRGH = 1; - break; - case 9600: - SPBRG2 = 129; - TXSTA2bits.BRGH = 1; - break; - default: - SPBRG2 = 129; - TXSTA2bits.BRGH = 1; - RS485_Set_Baud_Rate(9600); - break; - } - /* select async mode */ - TXSTA2bits.SYNC = 0; - /* enable transmitter */ - TXSTA2bits.TXEN = 1; - /* serial port enable */ - RCSTA2bits.SPEN = 1; - /* since we are using RS485, - we need to explicitly say - transmit enable or not */ - RS485_RX_DISABLE = 0; - RS485_TX_ENABLE = 0; -} - -/**************************************************************************** - * DESCRIPTION: Disables the RS485 hardware - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Disable_Port(void) -{ - RCSTA2 &= 0x4F; /* Disable the receiver */ - TXSTA2bits.TXEN = 0; /* and transmitter */ - PIE3 &= 0xCF; /* Disable both interrupts */ -} - -/**************************************************************************** - * DESCRIPTION: Reinitializes the port - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Reinit(void) -{ - RS485_Set_Baud_Rate(38400); -} - -/**************************************************************************** - * DESCRIPTION: Initializes the data and the port - * RETURN: none - * ALGORITHM: none - * NOTES: none - *****************************************************************************/ -void RS485_Initialize(void) -{ - /* Init the Rs485 buffers */ - FIFO_Init(&FIFO_Rx, RS485_Rx_Buffer, sizeof(RS485_Rx_Buffer)); - FIFO_Init(&FIFO_Tx, RS485_Tx_Buffer, sizeof(RS485_Tx_Buffer)); - - /* FIXME: read the stored baud rate */ - /* I2C_Read_Block( - EEPROM_DEVICE_ADDRESS, - (char *)&RS485_Baud_Rate, - sizeof(RS485_Baud_Rate), - EEPROM_MSTP_BAUD_RATE_ADDR); */ - - RS485_Initialize_Port(); -} diff --git a/ports/pic18f97j60/rs485.h b/ports/pic18f97j60/rs485.h deleted file mode 100644 index 3a232f3a..00000000 --- a/ports/pic18f97j60/rs485.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2004 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#ifndef RS485_H -#define RS485_H - -#include -#include "bacnet/datalink/mstp.h" - -extern uint32_t RS485_Baud_Rate; - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - void RS485_Reinit( - void); - void RS485_Initialize( - void); - - void RS485_Disable( - void); - - void RS485_Send_Frame( - volatile struct mstp_port_struct_t *mstp_port, /* port specific data */ - const uint8_t * buffer, /* frame to send (up to 501 bytes of data) */ - uint16_t nbytes); /* number of bytes of data (up to 501) */ - - /* returns true if there is more data waiting */ - bool RS485_Check_UART_Data( - volatile struct mstp_port_struct_t *mstp_port); /* port specific data */ - - void RS485_Interrupt_Rx( - void); - - void RS485_Interrupt_Tx( - void); - - uint32_t RS485_Get_Baud_Rate( - void); - bool RS485_Set_Baud_Rate( - uint32_t baud); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/pic18f97j60/stdbool.h b/ports/pic18f97j60/stdbool.h deleted file mode 100644 index 696ffd85..00000000 --- a/ports/pic18f97j60/stdbool.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STDBOOL_H -#define STDBOOL_H - -/* C99 Boolean types for compilers without C99 support */ - -#ifndef __cplusplus -typedef char _Bool; -#ifndef bool -#define bool _Bool -#endif -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif -#define __bool_true_false_are_defined 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#endif diff --git a/ports/pic18f97j60/stdint.h b/ports/pic18f97j60/stdint.h deleted file mode 100644 index 84e6d12f..00000000 --- a/ports/pic18f97j60/stdint.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Defines the standard integer types that are used in code */ - -#ifndef STDINT_H -#define STDINT_H 1 - -#include - -typedef unsigned char uint8_t; /* 1 byte 0 to 255 */ -typedef signed char int8_t; /* 1 byte -127 to 127 */ -typedef unsigned short uint16_t; /* 2 bytes 0 to 65535 */ -typedef signed short int16_t; /* 2 bytes -32767 to 32767 */ -/*typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215 */ -typedef unsigned long uint32_t; /* 4 bytes 0 to 4294967295 */ -typedef signed long int32_t; /* 4 bytes -2147483647 to 2147483647 */ -/* typedef signed long long int64_t; */ -/* typedef unsigned long long uint64_t; */ - -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647 - 1) - -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 - -#define UINT8_MAX 0xff /* 255U */ -#define UINT16_MAX 0xffff /* 65535U */ -#define UINT32_MAX 0xffffffff /* 4294967295U */ - -#endif /* STDINT_H */ diff --git a/ports/rx62n/bacnet.c b/ports/rx62n/bacnet.c deleted file mode 100644 index 9774d0d1..00000000 --- a/ports/rx62n/bacnet.c +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include -/* hardware layer includes */ -#include "hardware.h" -#include "bacnet/basic/sys/mstimer.h" -#include "led.h" -/* BACnet Stack includes */ -#include "bacnet/datalink/datalink.h" -#include "bacnet/npdu.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/services.h" -#include "bacnet/basic/tsm/tsm.h" -#include "bacnet/dcc.h" -#include "bacnet/iam.h" -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/bo.h" -/* me */ -#include "bacnet.h" - -/* timer for device communications control */ -static struct mstimer DCC_Timer; -#define DCC_CYCLE_SECONDS 1 - -void bacnet_init(void) -{ - /* initialize objects */ - Device_Init(NULL); - - /* set up our confirmed service unrecognized service handler - required! */ - apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service); - /* we need to handle who-is to support dynamic device binding */ - apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is); - apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has); - /* Set the handlers for any confirmed services that we support. */ - /* We must implement read property - it's required! */ - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property); - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_READ_PROP_MULTIPLE, handler_read_property_multiple); - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_REINITIALIZE_DEVICE, handler_reinitialize_device); - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_WRITE_PROPERTY, handler_write_property); - /* handle communication so we can shutup when asked */ - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL, - handler_device_communication_control); - /* start the cyclic 1 second timer for DCC */ - mstimer_set(&DCC_Timer, DCC_CYCLE_SECONDS * 1000); - /* Hello World! */ - Send_I_Am(&Handler_Transmit_Buffer[0]); -} - -/** Static receive buffer, initialized with zeros by the C Library Startup Code. - */ - -static uint8_t PDUBuffer - [MAX_MPDU + 16 /* Add a little safety margin to the buffer, - * so that in the rare case, the message - * would be filled up to MAX_MPDU and some - * decoding functions would overrun, these - * decoding functions will just end up in - * a safe field of static zeros. */ -]; - -void bacnet_task(void) -{ - uint16_t pdu_len; - BACNET_ADDRESS src; /* source address */ - uint8_t i; - BACNET_BINARY_PV binary_value = BINARY_INACTIVE; - BACNET_POLARITY polarity; - bool out_of_service; - - /* Binary Output */ - for (i = 0; i < MAX_BINARY_OUTPUTS; i++) { - out_of_service = Binary_Output_Out_Of_Service(i); - if (!out_of_service) { - binary_value = Binary_Output_Present_Value(i); - polarity = Binary_Output_Polarity(i); - if (polarity != POLARITY_NORMAL) { - if (binary_value == BINARY_ACTIVE) { - binary_value = BINARY_INACTIVE; - } else { - binary_value = BINARY_ACTIVE; - } - } - if (binary_value == BINARY_ACTIVE) { - led_on(i); - } else { - led_off(i); - } - } - } - /* handle the communication timer */ - if (mstimer_expired(&DCC_Timer)) { - mstimer_reset(&DCC_Timer); - dcc_timer_seconds(DCC_CYCLE_SECONDS); - } - /* handle the messaging */ - pdu_len = datalink_receive(&src, &PDUBuffer[0], MAX_MPDU, 0); - if (pdu_len) { - npdu_handler(&src, &PDUBuffer[0], pdu_len); - } -} diff --git a/ports/rx62n/bacnet.h b/ports/rx62n/bacnet.h deleted file mode 100644 index 32b65f85..00000000 --- a/ports/rx62n/bacnet.h +++ /dev/null @@ -1,23 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2010 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef BACNET_H -#define BACNET_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -void bacnet_init(void); -void bacnet_task(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/rx62n/bo.c b/ports/rx62n/bo.c deleted file mode 100644 index ed34acd1..00000000 --- a/ports/rx62n/bo.c +++ /dev/null @@ -1,482 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -/* Binary Output Objects - customize for your use */ - -#include -#include -#include -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacenum.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/wp.h" -#include "hardware.h" -#include "led.h" -#include "bacnet/basic/object/bo.h" -#include "bacnet/basic/services.h" - -#ifndef MAX_BINARY_OUTPUTS -#define MAX_BINARY_OUTPUTS 2 -#endif - -/* When all the priorities are level null, the present value returns */ -/* the Relinquish Default value */ -#define RELINQUISH_DEFAULT BINARY_INACTIVE -/* Here is our Priority Array.*/ -static uint8_t Binary_Output_Level[MAX_BINARY_OUTPUTS][BACNET_MAX_PRIORITY]; -/* Writable out-of-service allows others to play with our Present Value */ -/* without changing the physical output */ -static uint8_t Out_Of_Service[MAX_BINARY_OUTPUTS]; -/* polarity - normal or inverse */ -static uint8_t Polarity[MAX_BINARY_OUTPUTS]; - -/* These three arrays are used by the ReadPropertyMultiple handler */ -static const int32_t Binary_Output_Properties_Required[] = { - PROP_OBJECT_IDENTIFIER, - PROP_OBJECT_NAME, - PROP_OBJECT_TYPE, - PROP_PRESENT_VALUE, - PROP_STATUS_FLAGS, - PROP_EVENT_STATE, - PROP_OUT_OF_SERVICE, - PROP_POLARITY, - PROP_PRIORITY_ARRAY, - PROP_RELINQUISH_DEFAULT, - -1 -}; - -static const int32_t Binary_Output_Properties_Optional[] = { PROP_ACTIVE_TEXT, - PROP_INACTIVE_TEXT, - -1 }; - -static const int32_t Binary_Output_Properties_Proprietary[] = { -1 }; - -void Binary_Output_Property_Lists( - const int32_t **pRequired, - const int32_t **pOptional, - const int32_t **pProprietary) -{ - if (pRequired) { - *pRequired = Binary_Output_Properties_Required; - } - if (pOptional) { - *pOptional = Binary_Output_Properties_Optional; - } - if (pProprietary) { - *pProprietary = Binary_Output_Properties_Proprietary; - } - - return; -} - -/* we simply have 0-n object instances. */ -bool Binary_Output_Valid_Instance(uint32_t object_instance) -{ - if (object_instance < MAX_BINARY_OUTPUTS) { - return true; - } - - return false; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Output_Count(void) -{ - return MAX_BINARY_OUTPUTS; -} - -/* we simply have 0-n object instances. */ -uint32_t Binary_Output_Index_To_Instance(unsigned index) -{ - return index; -} - -/* we simply have 0-n object instances. */ -unsigned Binary_Output_Instance_To_Index(uint32_t object_instance) -{ - unsigned index = MAX_BINARY_OUTPUTS; - - if (object_instance < MAX_BINARY_OUTPUTS) { - index = object_instance; - } - - return index; -} - -static BACNET_BINARY_PV Present_Value(unsigned int index) -{ - BACNET_BINARY_PV value = RELINQUISH_DEFAULT; - BACNET_BINARY_PV current_value = RELINQUISH_DEFAULT; - unsigned i = 0; - - if (index < MAX_BINARY_OUTPUTS) { - for (i = 0; i < BACNET_MAX_PRIORITY; i++) { - current_value = (BACNET_BINARY_PV)Binary_Output_Level[index][i]; - if (current_value != BINARY_NULL) { - value = (BACNET_BINARY_PV)Binary_Output_Level[index][i]; - break; - } - } - } - - return value; -} - -BACNET_BINARY_PV Binary_Output_Present_Value(uint32_t object_instance) -{ - unsigned index = 0; - - index = Binary_Output_Instance_To_Index(object_instance); - - return Present_Value(index); -} - -bool Binary_Output_Present_Value_Set( - uint32_t instance, BACNET_BINARY_PV binary_value, unsigned priority) -{ /* 0..15 */ - bool status = false; - - if (instance < MAX_BINARY_OUTPUTS) { - if (priority < BACNET_MAX_PRIORITY) { - Binary_Output_Level[instance][priority] = (uint8_t)binary_value; - status = true; - } - } - - return status; -} - -static void -Binary_Output_Polarity_Set(uint32_t instance, BACNET_POLARITY polarity) -{ - if (instance < MAX_BINARY_OUTPUTS) { - if (polarity < MAX_POLARITY) { - Polarity[instance] = polarity; - } - } -} - -BACNET_POLARITY Binary_Output_Polarity(uint32_t instance) -{ - BACNET_POLARITY polarity = POLARITY_NORMAL; - - if (instance < MAX_BINARY_OUTPUTS) { - polarity = (BACNET_POLARITY)Polarity[instance]; - } - - return polarity; -} - -static void Binary_Output_Out_Of_Service_Set(uint32_t instance, bool flag) -{ - if (instance < MAX_BINARY_OUTPUTS) { - Out_Of_Service[instance] = flag; - } -} - -bool Binary_Output_Out_Of_Service(uint32_t instance) -{ - bool flag = false; - - if (instance < MAX_BINARY_OUTPUTS) { - flag = Out_Of_Service[instance]; - } - - return flag; -} - -/* note: the object name must be unique within this device */ -char *Binary_Output_Name(uint32_t object_instance) -{ - static char text[32]; /* okay for single thread */ - - if (object_instance < MAX_BINARY_OUTPUTS) { - snprintf(text, sizeof(text), "BO-%lu", (unsigned long)object_instance); - return text; - } - - return NULL; -} - -/* return apdu len, or -1 on error */ -int Binary_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int len = 0; - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - BACNET_BINARY_PV present_value = BINARY_INACTIVE; - unsigned object_index = 0; - unsigned i = 0; - bool state = false; - uint8_t *apdu = NULL; - - if ((rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - /* object id, object name, object type are handled in Device object - */ - case PROP_PRESENT_VALUE: - present_value = - Binary_Output_Present_Value(rpdata->object_instance); - apdu_len = encode_application_enumerated(&apdu[0], present_value); - break; - case PROP_STATUS_FLAGS: - /* note: see the details in the standard on how to use these */ - bitstring_init(&bit_string); - bitstring_set_bit(&bit_string, STATUS_FLAG_IN_ALARM, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_EVENT_STATE: - /* note: see the details in the standard on how to use this */ - apdu_len = - encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL); - break; - case PROP_OUT_OF_SERVICE: - object_index = - Binary_Output_Instance_To_Index(rpdata->object_instance); - state = Out_Of_Service[object_index]; - apdu_len = encode_application_boolean(&apdu[0], state); - break; - case PROP_POLARITY: - object_index = - Binary_Output_Instance_To_Index(rpdata->object_instance); - apdu_len = - encode_application_enumerated(&apdu[0], Polarity[object_index]); - break; - case PROP_PRIORITY_ARRAY: - /* Array element zero is the number of elements in the array */ - if (rpdata->array_index == 0) { - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY); - } - /* if no index was specified, then try to encode the entire list */ - /* into one packet. */ - else if (rpdata->array_index == BACNET_ARRAY_ALL) { - object_index = - Binary_Output_Instance_To_Index(rpdata->object_instance); - for (i = 0; i < BACNET_MAX_PRIORITY; i++) { - /* FIXME: check if we have room before adding it to APDU */ - present_value = - (BACNET_BINARY_PV)Binary_Output_Level[object_index][i]; - if (present_value == BINARY_NULL) { - len = encode_application_null(&apdu[apdu_len]); - } else { - len = encode_application_enumerated( - &apdu[apdu_len], present_value); - } - /* add it if we have room */ - if ((apdu_len + len) < MAX_APDU) { - apdu_len += len; - } else { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - apdu_len = BACNET_STATUS_ABORT; - break; - } - } - } else { - object_index = - Binary_Output_Instance_To_Index(rpdata->object_instance); - if (rpdata->array_index <= BACNET_MAX_PRIORITY) { - present_value = (BACNET_BINARY_PV) - Binary_Output_Level[object_index] - [rpdata->array_index - 1]; - if (present_value == BINARY_NULL) { - apdu_len = encode_application_null(&apdu[apdu_len]); - } else { - apdu_len = encode_application_enumerated( - &apdu[apdu_len], present_value); - } - } else { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - apdu_len = BACNET_STATUS_ERROR; - } - } - break; - case PROP_RELINQUISH_DEFAULT: - present_value = RELINQUISH_DEFAULT; - apdu_len = encode_application_enumerated(&apdu[0], present_value); - break; - case PROP_ACTIVE_TEXT: - characterstring_init_ansi(&char_string, "on"); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_INACTIVE_TEXT: - characterstring_init_ansi(&char_string, "off"); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = BACNET_STATUS_ERROR; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->object_property != PROP_PRIORITY_ARRAY) && - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - unsigned int priority = 0; - BACNET_BINARY_PV level = BINARY_NULL; - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_PRIORITY_ARRAY) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_PRESENT_VALUE: - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED); - if (status) { - priority = wp_data->priority; - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - if (priority && (priority <= BACNET_MAX_PRIORITY) && - (priority != 6 /* reserved */) && - (value.type.Enumerated <= MAX_BINARY_PV)) { - level = (BACNET_BINARY_PV)value.type.Enumerated; - priority--; - Binary_Output_Present_Value_Set( - wp_data->object_instance, level, priority); - } else if (priority == 6) { - /* Command priority 6 is reserved for use by Minimum On/Off - algorithm and may not be used for other purposes in any - object. */ - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } else { - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_NULL); - if (status) { - level = BINARY_NULL; - priority = wp_data->priority; - if (priority && (priority <= BACNET_MAX_PRIORITY)) { - priority--; - Binary_Output_Present_Value_Set( - wp_data->object_instance, level, priority); - } else if (priority == 6) { - status = false; - /* Command priority 6 is reserved for use by Minimum - On/Off algorithm and may not be used for other - purposes in any object. */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } else { - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } - } - break; - case PROP_OUT_OF_SERVICE: - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN); - if (status) { - Binary_Output_Out_Of_Service_Set( - wp_data->object_instance, value.type.Boolean); - } - break; - case PROP_POLARITY: - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED); - if (status) { - if (value.type.Enumerated < MAX_POLARITY) { - Binary_Output_Polarity_Set( - wp_data->object_instance, - (BACNET_POLARITY)value.type.Enumerated); - } else { - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } - break; - case PROP_OBJECT_IDENTIFIER: - case PROP_OBJECT_NAME: - case PROP_OBJECT_TYPE: - case PROP_STATUS_FLAGS: - case PROP_RELIABILITY: - case PROP_EVENT_STATE: - case PROP_POLARITY: - case PROP_PRIORITY_ARRAY: - case PROP_RELINQUISH_DEFAULT: - case PROP_ACTIVE_TEXT: - case PROP_INACTIVE_TEXT: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - /* not using len at this time */ - len = len; - - return status; -} - -void Binary_Output_Init(void) -{ - unsigned i, j; - - /* initialize all the analog output priority arrays to NULL */ - for (i = 0; i < MAX_BINARY_OUTPUTS; i++) { - Binary_Output_Polarity_Set(i, POLARITY_NORMAL); - Binary_Output_Out_Of_Service_Set(i, false); - for (j = 0; j < BACNET_MAX_PRIORITY; j++) { - Binary_Output_Present_Value_Set(i, BINARY_NULL, j); - } - } - - return; -} diff --git a/ports/rx62n/device.c b/ports/rx62n/device.c deleted file mode 100644 index 4df8da41..00000000 --- a/ports/rx62n/device.c +++ /dev/null @@ -1,1010 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ - -#include -#include -#include /* for memmove */ -#include "bacnet/bacdef.h" -#include "bacnet/bacdcode.h" -#include "bacnet/bacstr.h" -#include "bacnet/bacenum.h" -#include "bacnet/bacapp.h" -#include "bacnet/config.h" /* the custom stuff */ -#include "bacnet/apdu.h" -#include "bacnet/wp.h" /* WriteProperty handling */ -#include "bacnet/rp.h" /* ReadProperty handling */ -#include "bacnet/dcc.h" /* DeviceCommunicationControl handling */ -#include "bacnet/version.h" -#include "bacnet/basic/object/device.h" /* me */ -#include "bacnet/basic/services.h" -#include "bacnet/datalink/datalink.h" -#include "bacnet/basic/binding/address.h" -#include "bacnet/proplist.h" -/* os specfic includes */ -#include "bacnet/basic/sys/mstimer.h" -/* objects */ -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/object/bo.h" - -/* forward prototype */ -int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata); -bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data); - -static struct my_object_functions { - BACNET_OBJECT_TYPE Object_Type; - object_init_function Object_Init; - object_count_function Object_Count; - object_index_to_instance_function Object_Index_To_Instance; - object_valid_instance_function Object_Valid_Instance; - object_name_function Object_Name; - read_property_function Object_Read_Property; - write_property_function Object_Write_Property; - rpm_property_lists_function Object_RPM_List; -} Object_Table[] = { - { OBJECT_DEVICE, NULL, /* don't init - recursive! */ - Device_Count, Device_Index_To_Instance, - Device_Valid_Object_Instance_Number, Device_Name, - Device_Read_Property_Local, Device_Write_Property_Local, - Device_Property_Lists }, - { OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count, - Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, - Binary_Output_Object_Name, Binary_Output_Read_Property, - Binary_Output_Write_Property, Binary_Output_Property_Lists }, - { MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -/* note: you really only need to define variables for - properties that are writable or that may change. - The properties that are constant can be hard coded - into the read-property encoding. */ -static uint32_t Object_Instance_Number = 12345; -static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL; -static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE; -static const char *Reinit_Password = "filister"; -static char My_Object_Name[MAX_DEV_NAME_LEN + 1] = "SimpleServer"; -static char Model_Name[MAX_DEV_MOD_LEN + 1] = "RX62N"; -static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0"; -static const char *BACnet_Version = BACNET_VERSION_TEXT; -static char Location[MAX_DEV_LOC_LEN + 1] = "USA"; -static char Description[MAX_DEV_DESC_LEN + 1] = "Renesas Rulz!"; -static uint32_t Database_Revision = 0; - -/* These three arrays are used by the ReadPropertyMultiple handler */ -static const int32_t Device_Properties_Required[] = { - PROP_OBJECT_IDENTIFIER, - PROP_OBJECT_NAME, - PROP_OBJECT_TYPE, - PROP_SYSTEM_STATUS, - PROP_VENDOR_NAME, - PROP_VENDOR_IDENTIFIER, - PROP_MODEL_NAME, - PROP_FIRMWARE_REVISION, - PROP_APPLICATION_SOFTWARE_VERSION, - PROP_PROTOCOL_VERSION, - PROP_PROTOCOL_REVISION, - PROP_PROTOCOL_SERVICES_SUPPORTED, - PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED, - PROP_OBJECT_LIST, - PROP_MAX_APDU_LENGTH_ACCEPTED, - PROP_SEGMENTATION_SUPPORTED, - PROP_APDU_TIMEOUT, - PROP_NUMBER_OF_APDU_RETRIES, - PROP_MAX_MASTER, - PROP_MAX_INFO_FRAMES, - PROP_DEVICE_ADDRESS_BINDING, - PROP_DATABASE_REVISION, - -1 -}; - -static const int32_t Device_Properties_Optional[] = { PROP_DESCRIPTION, -1 }; - -static const int32_t Device_Properties_Proprietary[] = { -1 }; - -static struct my_object_functions * -Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type) -{ - struct my_object_functions *pObject = NULL; - - pObject = &Object_Table[0]; - while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) { - /* handle each object type */ - if (pObject->Object_Type == Object_Type) { - return (pObject); - } - - pObject++; - } - - return (NULL); -} - -static int Read_Property_Common( - const struct my_object_functions *pObject, - BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = BACNET_STATUS_ERROR; - BACNET_CHARACTER_STRING char_string; - const char *pString = ""; - uint8_t *apdu = NULL; -#if (BACNET_PROTOCOL_REVISION >= 14) - struct special_property_list_t property_list; -#endif - - if ((rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - switch (rpdata->object_property) { - case PROP_OBJECT_IDENTIFIER: - /* Device Object exception: requested instance - may not match our instance if a wildcard */ - if (rpdata->object_type == OBJECT_DEVICE) { - rpdata->object_instance = Object_Instance_Number; - } - apdu_len = encode_application_object_id( - &apdu[0], rpdata->object_type, rpdata->object_instance); - break; - case PROP_OBJECT_NAME: - if (pObject->Object_Name) { - pString = - pObject->Object_Name(rpdata->object_instance, &char_string); - } - characterstring_init_ansi(&char_string, pString); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_OBJECT_TYPE: - apdu_len = - encode_application_enumerated(&apdu[0], rpdata->object_type); - break; -#if (BACNET_PROTOCOL_REVISION >= 14) - case PROP_PROPERTY_LIST: - Device_Objects_Property_List( - rpdata->object_type, rpdata->object_instance, &property_list); - apdu_len = property_list_encode( - rpdata, property_list.Required.pList, - property_list.Optional.pList, property_list.Proprietary.pList); - break; -#endif - default: - if (pObject->Object_Read_Property) { - apdu_len = pObject->Object_Read_Property(rpdata); - } - break; - } - - return apdu_len; -} - -static unsigned property_list_count(const int32_t *pList) -{ - unsigned property_count = 0; - - if (pList) { - while (*pList != -1) { - property_count++; - pList++; - } - } - - return property_count; -} - -/** For a given object type, returns the special property list. - * This function is used for ReadPropertyMultiple calls which want - * just Required, just Optional, or All properties. - * @ingroup ObjIntf - * - * @param object_type [in] The desired BACNET_OBJECT_TYPE whose properties - * are to be listed. - * @param pPropertyList [out] Reference to the structure which will, on return, - * list, separately, the Required, Optional, and Proprietary object - * properties with their counts. - */ -void Device_Objects_Property_List( - BACNET_OBJECT_TYPE object_type, - uint32_t object_instance, - struct special_property_list_t *pPropertyList) -{ - struct my_object_functions *pObject = NULL; - - (void)object_instance; - pPropertyList->Required.pList = NULL; - pPropertyList->Optional.pList = NULL; - pPropertyList->Proprietary.pList = NULL; - - /* If we can find an entry for the required object type - * and there is an Object_List_RPM fn ptr then call it - * to populate the pointers to the individual list counters. - */ - - pObject = Device_Objects_Find_Functions(object_type); - if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) { - pObject->Object_RPM_List( - &pPropertyList->Required.pList, &pPropertyList->Optional.pList, - &pPropertyList->Proprietary.pList); - } - - /* Fetch the counts if available otherwise zero them */ - pPropertyList->Required.count = pPropertyList->Required.pList == NULL - ? 0 - : property_list_count(pPropertyList->Required.pList); - - pPropertyList->Optional.count = pPropertyList->Optional.pList == NULL - ? 0 - : property_list_count(pPropertyList->Optional.pList); - - pPropertyList->Proprietary.count = pPropertyList->Proprietary.pList == NULL - ? 0 - : property_list_count(pPropertyList->Proprietary.pList); - - return; -} - -void Device_Property_Lists( - const int32_t **pRequired, - const int32_t **pOptional, - const int32_t **pProprietary) -{ - if (pRequired) { - *pRequired = Device_Properties_Required; - } - if (pOptional) { - *pOptional = Device_Properties_Optional; - } - if (pProprietary) { - *pProprietary = Device_Properties_Proprietary; - } - - return; -} - -unsigned Device_Count(void) -{ - return 1; -} - -uint32_t Device_Index_To_Instance(unsigned index) -{ - index = index; - return Object_Instance_Number; -} - -/** - * @brief Sets the ReinitializeDevice password - * - * The password shall be a null terminated C string of up to - * 20 ASCII characters for those devices that require the password. - * - * For those devices that do not require a password, set to NULL or - * point to a zero length C string (null terminated). - * - * @param the ReinitializeDevice password; can be NULL or empty string - */ -bool Device_Reinitialize_Password_Set(const char *password) -{ - Reinit_Password = password; - - return true; -} - -/** - * @brief Commands a Device re-initialization, to a given state. - * The request's password must match for the operation to succeed. - * This implementation provides a framework, but doesn't - * actually *DO* anything. - * @note You could use a mix of states and passwords to multiple outcomes. - * @note You probably want to restart *after* the simple ack has been sent - * from the return handler, so just set a local flag here. - * @ingroup ObjIntf - * - * @param rd_data [in,out] The information from the RD request. - * On failure, the error class and code will be set. - * @return True if succeeds (password is correct), else False. - */ -bool Device_Reinitialize(BACNET_REINITIALIZE_DEVICE_DATA *rd_data) -{ - bool status = false; - bool password_success = false; - - /* From 16.4.1.1.2 Password - This optional parameter shall be a CharacterString of up to - 20 characters. For those devices that require the password as a - protection, the service request shall be denied if the parameter - is absent or if the password is incorrect. For those devices that - do not require a password, this parameter shall be ignored.*/ - if (Reinit_Password && strlen(Reinit_Password) > 0) { - if (characterstring_length(&rd_data->password) > 20) { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE; - } else if (characterstring_ansi_same( - &rd_data->password, Reinit_Password)) { - password_success = true; - } else { - rd_data->error_class = ERROR_CLASS_SECURITY; - rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE; - } - } else { - password_success = true; - } - if (password_success) { - switch (rd_data->state) { - case BACNET_REINIT_COLDSTART: - case BACNET_REINIT_WARMSTART: - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); - /* note: you probably want to restart *after* the - simple ack has been sent from the return handler - so just set a flag from here */ - Reinitialize_State = rd_data->state; - status = true; - break; - case BACNET_REINIT_STARTBACKUP: - case BACNET_REINIT_ENDBACKUP: - case BACNET_REINIT_STARTRESTORE: - case BACNET_REINIT_ENDRESTORE: - case BACNET_REINIT_ABORTRESTORE: - if (dcc_communication_disabled()) { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED; - } else { - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = - ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED; - } - break; - default: - rd_data->error_class = ERROR_CLASS_SERVICES; - rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE; - break; - } - } - - return status; -} - -BACNET_REINITIALIZED_STATE Device_Reinitialized_State(void) -{ - return Reinitialize_State; -} - -/* methods to manipulate the data */ -uint32_t Device_Object_Instance_Number(void) -{ - return Object_Instance_Number; -} - -bool Device_Set_Object_Instance_Number(uint32_t object_id) -{ - bool status = true; /* return value */ - - if (object_id <= BACNET_MAX_INSTANCE) { - Object_Instance_Number = object_id; - } else { - status = false; - } - - return status; -} - -bool Device_Valid_Object_Instance_Number(uint32_t object_id) -{ - return (Object_Instance_Number == object_id); -} - -char *Device_Name(uint32_t object_instance) -{ - if (object_instance == Object_Instance_Number) { - return My_Object_Name; - } - - return NULL; -} - -const char *Device_Object_Name(void) -{ - return My_Object_Name; -} - -bool Device_Set_Object_Name(const char *name, size_t length) -{ - bool status = false; /*return value */ - - /* FIXME: All the object names in a device must be unique. - Disallow setting the Device Object Name to any objects in - the device. */ - if (length < sizeof(My_Object_Name)) { - /* Make the change and update the database revision */ - memmove(My_Object_Name, name, length); - My_Object_Name[length] = 0; - Device_Inc_Database_Revision(); - status = true; - } - - return status; -} - -BACNET_DEVICE_STATUS Device_System_Status(void) -{ - return System_Status; -} - -int Device_Set_System_Status(BACNET_DEVICE_STATUS status, bool local) -{ - /*return value - 0 = ok, -1 = bad value, -2 = not allowed */ - int result = -1; - - if (status < MAX_DEVICE_STATUS) { - System_Status = status; - result = 0; - } - - return result; -} - -const char *Device_Description(void) -{ - return Description; -} - -bool Device_Set_Description(const char *name, size_t length) -{ - bool status = false; /*return value */ - - if (length < sizeof(Description)) { - memmove(Description, name, length); - Description[length] = 0; - status = true; - } - - return status; -} - -const char *Device_Location(void) -{ - return Location; -} - -bool Device_Set_Location(const char *name, size_t length) -{ - bool status = false; /*return value */ - - if (length < sizeof(Location)) { - memmove(Location, name, length); - Location[length] = 0; - status = true; - } - - return status; -} - -uint8_t Device_Protocol_Version(void) -{ - return BACNET_PROTOCOL_VERSION; -} - -uint8_t Device_Protocol_Revision(void) -{ - return BACNET_PROTOCOL_REVISION; -} - -uint16_t Device_Vendor_Identifier(void) -{ - return BACNET_VENDOR_ID; -} - -BACNET_SEGMENTATION Device_Segmentation_Supported(void) -{ - return SEGMENTATION_NONE; -} - -uint32_t Device_Database_Revision(void) -{ - return Database_Revision; -} - -void Device_Inc_Database_Revision(void) -{ - Database_Revision++; -} - -/* Since many network clients depend on the object list */ -/* for discovery, it must be consistent! */ -unsigned Device_Object_List_Count(void) -{ - unsigned count = 0; /* number of objects */ - struct my_object_functions *pObject = NULL; - - /* initialize the default return values */ - pObject = &Object_Table[0]; - while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) { - if (pObject->Object_Count) { - count += pObject->Object_Count(); - } - pObject++; - } - - return count; -} - -bool Device_Object_List_Identifier( - uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance) -{ - bool status = false; - uint32_t count = 0; - uint32_t object_index = 0; - struct my_object_functions *pObject = NULL; - - /* array index zero is length - so invalid */ - if (array_index == 0) { - return status; - } - object_index = array_index - 1; - /* initialize the default return values */ - pObject = &Object_Table[0]; - while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) { - if (pObject->Object_Count && pObject->Object_Index_To_Instance) { - object_index -= count; - count = pObject->Object_Count(); - if (object_index < count) { - *object_type = pObject->Object_Type; - *instance = pObject->Object_Index_To_Instance(object_index); - status = true; - break; - } - } - pObject++; - } - - return status; -} - -/** - * @brief Encode a BACnetARRAY property element - * @param object_instance [in] BACnet network port object instance number - * @param array_index [in] array index requested: - * 0 to N for individual array members - * @param apdu [out] Buffer in which the APDU contents are built, or NULL to - * return the length of buffer if it had been built - * @return The length of the apdu encoded or - * BACNET_STATUS_ERROR for ERROR_CODE_INVALID_ARRAY_INDEX - */ -int Device_Object_List_Element_Encode( - uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu) -{ - int apdu_len = BACNET_STATUS_ERROR; - BACNET_OBJECT_TYPE object_type; - uint32_t instance; - bool found; - - if (object_instance == Device_Object_Instance_Number()) { - /* single element is zero based, add 1 for BACnetARRAY which is one - * based */ - array_index++; - found = - Device_Object_List_Identifier(array_index, &object_type, &instance); - if (found) { - apdu_len = - encode_application_object_id(apdu, object_type, instance); - } - } - - return apdu_len; -} - -/** Determine if we have an object with the given object_name. - * If the object_type and object_instance pointers are not null, - * and the lookup succeeds, they will be given the resulting values. - * @param object_name [in] The desired Object Name to look for. - * @param object_type [out] The BACNET_OBJECT_TYPE of the matching Object. - * @param object_instance [out] The object instance number of the matching - * Object. - * @return True on success or else False if not found. - */ -bool Device_Valid_Object_Name( - const char *object_name, - BACNET_OBJECT_TYPE *object_type, - uint32_t *object_instance) -{ - bool found = false; - BACNET_OBJECT_TYPE type = OBJECT_NONE; - uint32_t instance; - uint32_t max_objects = 0, i = 0; - bool check_id = false; - char *name = NULL; - - max_objects = Device_Object_List_Count(); - for (i = 1; i <= max_objects; i++) { - check_id = Device_Object_List_Identifier(i, &type, &instance); - if (check_id) { - name = Device_Valid_Object_Id(type, instance); - if (strcmp(name, object_name) == 0) { - found = true; - if (object_type) { - *object_type = type; - } - if (object_instance) { - *object_instance = instance; - } - break; - } - } - } - - return found; -} - -/* returns the name or NULL if not found */ -char * -Device_Valid_Object_Id(BACNET_OBJECT_TYPE object_type, uint32_t object_instance) -{ - char *name = NULL; /* return value */ - struct my_object_functions *pObject = NULL; - - pObject = Device_Objects_Find_Functions((BACNET_OBJECT_TYPE)object_type); - if ((pObject) && (pObject->Object_Name)) { - name = pObject->Object_Name(object_instance); - } - - return name; -} - -/* return the length of the apdu encoded or BACNET_STATUS_ERROR for error */ -int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = 0; /* return value */ - BACNET_BIT_STRING bit_string; - BACNET_CHARACTER_STRING char_string; - uint32_t i = 0; - uint32_t count = 0; - uint8_t *apdu = NULL; - int apdu_max = 0; - struct my_object_functions *pObject = NULL; - - if ((rpdata->application_data == NULL) || - (rpdata->application_data_len == 0)) { - return 0; - } - apdu = rpdata->application_data; - apdu_max = rpdata->application_data_len; - switch (rpdata->object_property) { - case PROP_DESCRIPTION: - characterstring_init_ansi(&char_string, Description); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_SYSTEM_STATUS: - apdu_len = - encode_application_enumerated(&apdu[0], Device_System_Status()); - break; - case PROP_VENDOR_NAME: - characterstring_init_ansi(&char_string, BACNET_VENDOR_NAME); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_VENDOR_IDENTIFIER: - apdu_len = encode_application_unsigned(&apdu[0], BACNET_VENDOR_ID); - break; - case PROP_MODEL_NAME: - characterstring_init_ansi(&char_string, Model_Name); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_FIRMWARE_REVISION: - characterstring_init_ansi(&char_string, BACnet_Version); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_APPLICATION_SOFTWARE_VERSION: - characterstring_init_ansi( - &char_string, Application_Software_Version); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_LOCATION: - characterstring_init_ansi(&char_string, Location); - apdu_len = - encode_application_character_string(&apdu[0], &char_string); - break; - case PROP_PROTOCOL_VERSION: - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_VERSION); - break; - case PROP_PROTOCOL_REVISION: - apdu_len = - encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_REVISION); - break; - case PROP_PROTOCOL_SERVICES_SUPPORTED: - /* Note: list of services that are executed, not initiated. */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { - /* automatic lookup based on handlers set */ - bitstring_set_bit( - &bit_string, (uint8_t)i, - apdu_service_supported((BACNET_SERVICES_SUPPORTED)i)); - } - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - /* Note: this is the list of objects that can be in this device, - not a list of objects that this device can access */ - bitstring_init(&bit_string); - for (i = 0; i < MAX_ASHRAE_OBJECT_TYPE; i++) { - /* FIXME: if ReadProperty used an array of Functions... */ - /* initialize all the object types to not-supported */ - bitstring_set_bit(&bit_string, (uint8_t)i, false); - } - /* set the object types with objects to supported */ - i = 0; - pObject = &Object_Table[i]; - while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) { - if ((pObject->Object_Count) && (pObject->Object_Count() > 0)) { - bitstring_set_bit(&bit_string, pObject->Object_Type, true); - } - pObject++; - } - apdu_len = encode_application_bitstring(&apdu[0], &bit_string); - break; - case PROP_OBJECT_LIST: - count = Device_Object_List_Count(); - apdu_len = bacnet_array_encode( - rpdata->object_instance, rpdata->array_index, - Device_Object_List_Element_Encode, count, apdu, apdu_max); - if (apdu_len == BACNET_STATUS_ABORT) { - rpdata->error_code = - ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; - } else if (apdu_len == BACNET_STATUS_ERROR) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_INVALID_ARRAY_INDEX; - } - break; - case PROP_MAX_APDU_LENGTH_ACCEPTED: - apdu_len = encode_application_unsigned(&apdu[0], MAX_APDU); - break; - case PROP_SEGMENTATION_SUPPORTED: - apdu_len = encode_application_enumerated( - &apdu[0], Device_Segmentation_Supported()); - break; - case PROP_APDU_TIMEOUT: - apdu_len = encode_application_unsigned(&apdu[0], apdu_timeout()); - break; - case PROP_NUMBER_OF_APDU_RETRIES: - apdu_len = encode_application_unsigned(&apdu[0], apdu_retries()); - break; - case PROP_DEVICE_ADDRESS_BINDING: - /* FIXME: encode the list here, if it exists */ - break; - case PROP_DATABASE_REVISION: - apdu_len = encode_application_unsigned(&apdu[0], Database_Revision); - break; - default: - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - apdu_len = BACNET_STATUS_ERROR; - break; - } - /* only array properties can have array options */ - if ((apdu_len >= 0) && (rpdata->object_property != PROP_OBJECT_LIST) && - (rpdata->array_index != BACNET_ARRAY_ALL)) { - rpdata->error_class = ERROR_CLASS_PROPERTY; - rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - apdu_len = BACNET_STATUS_ERROR; - } - - return apdu_len; -} - -/** Looks up the requested Object and Property, and encodes its Value in an - * APDU. - * @ingroup ObjIntf - * 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 - * on entry, and APDU message on return. - * @return The length of the APDU on success, else BACNET_STATUS_ERROR - */ -int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata) -{ - int apdu_len = BACNET_STATUS_ERROR; - struct my_object_functions *pObject = NULL; - - /* initialize the default return values */ - rpdata->error_class = ERROR_CLASS_OBJECT; - rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT; - pObject = Device_Objects_Find_Functions(rpdata->object_type); - if (pObject) { - if (pObject->Object_Valid_Instance && - pObject->Object_Valid_Instance(rpdata->object_instance)) { - apdu_len = Read_Property_Common(pObject, rpdata); - } else { - rpdata->error_class = ERROR_CLASS_OBJECT; - rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT; - } - } else { - rpdata->error_class = ERROR_CLASS_OBJECT; - rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT; - } - - return apdu_len; -} - -/* returns true if successful */ -bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; /* return value */ - int len = 0; - BACNET_APPLICATION_DATA_VALUE value = { 0 }; - int temp; - - /* decode the some of the request */ - len = bacapp_decode_application_data( - wp_data->application_data, wp_data->application_data_len, &value); - /* FIXME: len < application_data_len: more data? */ - if (len < 0) { - /* error while decoding - a value larger than we can handle */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - return false; - } - if ((wp_data->object_property != PROP_OBJECT_LIST) && - (wp_data->array_index != BACNET_ARRAY_ALL)) { - /* only array properties can have array options */ - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; - return false; - } - switch (wp_data->object_property) { - case PROP_OBJECT_IDENTIFIER: - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_OBJECT_ID); - if (status) { - if ((value.type.Object_Id.type == OBJECT_DEVICE) && - (Device_Set_Object_Instance_Number( - value.type.Object_Id.instance))) { - /* we could send an I-Am broadcast to let the world know */ - status = true; - } else { - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } - } - break; - case PROP_SYSTEM_STATUS: - status = write_property_type_valid( - wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED); - if (status) { - temp = Device_Set_System_Status( - (BACNET_DEVICE_STATUS)value.type.Enumerated, false); - if (temp != 0) { - status = false; - wp_data->error_class = ERROR_CLASS_PROPERTY; - if (temp == -1) { - wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; - } else { - wp_data->error_code = - ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED; - } - } - } - break; - case PROP_OBJECT_NAME: - status = - write_property_string_valid(&wp_data, &value, MAX_DEV_NAME_LEN); - if (status) { - Device_Set_Object_Name( - characterstring_value(&value.type.Character_String), - characterstring_length(&value.type.Character_String)); - } - break; - case PROP_LOCATION: - status = write_property_empty_string_valid( - &wp_data, &value, MAX_DEV_LOC_LEN); - if (status) { - Device_Set_Location( - characterstring_value(&value.type.Character_String), - characterstring_length(&value.type.Character_String)); - } - break; - - case PROP_DESCRIPTION: - status = write_property_empty_string_valid( - &wp_data, &value, MAX_DEV_DESC_LEN); - if (status) { - Device_Set_Description( - characterstring_value(&value.type.Character_String), - characterstring_length(&value.type.Character_String)); - } - break; - case PROP_OBJECT_TYPE: - case PROP_VENDOR_NAME: - case PROP_VENDOR_IDENTIFIER: - case PROP_MODEL_NAME: - case PROP_FIRMWARE_REVISION: - case PROP_APPLICATION_SOFTWARE_VERSION: - case PROP_PROTOCOL_VERSION: - case PROP_PROTOCOL_REVISION: - case PROP_PROTOCOL_SERVICES_SUPPORTED: - case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED: - case PROP_OBJECT_LIST: - case PROP_MAX_APDU_LENGTH_ACCEPTED: - case PROP_SEGMENTATION_SUPPORTED: - case PROP_DEVICE_ADDRESS_BINDING: - case PROP_ACTIVE_COV_SUBSCRIPTIONS: - case PROP_DATABASE_REVISION: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - break; - default: - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; - break; - } - /* not using len at this time */ - len = len; - - return status; -} - -/** Looks up the requested Object and Property, and set the new Value in it, - * if allowed. - * If the Object or Property can't be found, sets the error class and code. - * @ingroup ObjIntf - * - * @param wp_data [in,out] Structure with the desired Object and Property info - * and new Value on entry, and APDU message on return. - * @return True on success, else False if there is an error. - */ -bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data) -{ - bool status = false; - struct my_object_functions *pObject = NULL; - - /* initialize the default return values */ - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - pObject = Device_Objects_Find_Functions(wp_data->object_type); - if (pObject != NULL) { - if (pObject->Object_Valid_Instance && - pObject->Object_Valid_Instance(wp_data->object_instance)) { - if (pObject->Object_Write_Property) { - status = pObject->Object_Write_Property(wp_data); - } else { - wp_data->error_class = ERROR_CLASS_PROPERTY; - wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; - } - } else { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - } - } else { - wp_data->error_class = ERROR_CLASS_OBJECT; - wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT; - } - - return status; -} - -/** Initialize the Device Object and each of its child Object instances. - * @ingroup ObjIntf - */ -void Device_Init(object_functions_t *object_table) -{ - struct my_object_functions *pObject = NULL; - - /* not using the standard table - using our own */ - (void)object_table; - pObject = &Object_Table[0]; - while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) { - if (pObject->Object_Init) { - pObject->Object_Init(); - } - pObject++; - } - dcc_set_status_duration(COMMUNICATION_ENABLE, 0); -} diff --git a/ports/rx62n/ethernet.c b/ports/rx62n/ethernet.c deleted file mode 100644 index aa2a7128..00000000 --- a/ports/rx62n/ethernet.c +++ /dev/null @@ -1,229 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include /* for standard integer types uint8_t etc. */ -#include /* for the standard bool type. */ -#include "bacnet/bacdef.h" -#include "bacnet/datalink/ethernet.h" -#include "bacnet/bacint.h" -#include "hardware.h" - -/** @file rx62n/ethernet.c Provides Renesas RX62N-specific functions - for BACnet/Ethernet. */ - -/* commonly used comparison address for ethernet */ -static uint8_t Ethernet_Broadcast[MAX_MAC_LEN] = { 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF }; - -/* IEEE maintains list of 48-bit MAC "addresses" AKA EUI-48 identifiers. - An EUI-48 is structured into an initial 3-octet OUI - (Organizationally Unique Identifier) and an additional 3 octets - assigned by the OUI holder. */ -/* see [RFC5342] for current information and registration procedures. */ -/* The OUI 00-00-5E has been allocated to IANA. */ -/* my local device data - MAC address */ -static uint8_t Ethernet_MAC_Address[MAX_MAC_LEN] = { 0x00, 0x00, 0x5E, - 0x00, 0x00, 0x01 }; - -/* status of the link */ -static int32_t Ethernet_Status = R_ETHER_ERROR; - -bool ethernet_valid(void) -{ - if (Ethernet_Status != R_ETHER_OK) { - Ethernet_Status = R_Ether_Open(0, Ethernet_MAC_Address); - } - - return (Ethernet_Status != R_ETHER_ERROR); -} - -void ethernet_cleanup(void) -{ - R_Ether_Close(0); - Ethernet_Status = R_ETHER_ERROR; - - return; -} - -bool ethernet_init(char *interface_name) -{ - interface_name = interface_name; - Ethernet_Status = R_Ether_Open(0, Ethernet_MAC_Address); - - return (Ethernet_Status == R_ETHER_OK); -} - -int ethernet_send(uint8_t *mtu, int mtu_len) -{ - int bytes = 0; - - /* Send the packet */ - bytes = R_Ether_Write(0, mtu, mtu_len); - - return bytes; -} - -/* function to send a packet out the 802.2 socket */ -/* returns number of bytes sent on success, negative on failure */ -int ethernet_send_pdu( - BACNET_ADDRESS *dest, /* destination address */ - BACNET_NPDU_DATA *npdu_data, /* network information */ - uint8_t *pdu, /* any data to be sent - may be null */ - unsigned pdu_len) -{ /* number of bytes of data */ - int i = 0; /* counter */ - int bytes = 0; - BACNET_ADDRESS src = { 0 }; /* source address for npdu */ - uint8_t mtu[ETHERNET_MPDU_MAX] = { 0 }; /* our buffer */ - int mtu_len = 0; - - (void)npdu_data; - /* load the BACnet address for NPDU data */ - for (i = 0; i < 6; i++) { - src.mac[i] = Ethernet_MAC_Address[i]; - src.mac_len++; - } - - /* don't waste time if the socket is not valid */ - if (!ethernet_valid()) { - return -1; - } - /* load destination ethernet MAC address */ - if (dest->mac_len == 6) { - for (i = 0; i < 6; i++) { - mtu[i] = dest->mac[i]; - } - } else { - return -2; - } - - /* load source ethernet MAC address */ - if (src.mac_len == 6) { - for (i = 0; i < 6; i++) { - mtu[6 + i] = src.mac[i]; - } - } else { - return -3; - } - /* Logical PDU portion */ - mtu[14] = 0x82; /* DSAP for BACnet */ - mtu[15] = 0x82; /* SSAP for BACnet */ - mtu[16] = 0x03; /* Control byte in header */ - mtu_len = 17; - if ((mtu_len + pdu_len) > ETHERNET_MPDU_MAX) { - return -4; - } - memcpy(&mtu[mtu_len], pdu, pdu_len); - mtu_len += pdu_len; - /* packet length - only the logical portion, not the address */ - encode_unsigned16(&mtu[12], 3 + pdu_len); - - /* Send the packet */ - bytes = R_Ether_Write(0, mtu, mtu_len); - - return bytes; -} - -/* receives an 802.2 framed packet */ -/* returns the number of octets in the PDU, or zero on failure */ -uint16_t ethernet_receive( - BACNET_ADDRESS *src, /* source address */ - uint8_t *pdu, /* PDU data */ - uint16_t max_pdu, /* amount of space available in the PDU */ - unsigned timeout) -{ /* number of milliseconds to wait for a packet */ - int received_bytes; - uint8_t buf[ETHERNET_MPDU_MAX] = { 0 }; /* data */ - uint16_t pdu_len = 0; /* return value */ - - /* Make sure the socket is open */ - if (!ethernet_valid()) { - return 0; - } - - received_bytes = R_Ether_Read(0, (void *)buf); - - if (received_bytes == 0) { - return 0; - } - - /* the signature of an 802.2 BACnet packet */ - if ((buf[14] != 0x82) && (buf[15] != 0x82)) { - return 0; - } - /* copy the source address */ - src->mac_len = 6; - memmove(src->mac, &buf[6], 6); - - /* check destination address for when */ - /* the Ethernet card is in promiscious mode */ - if ((memcmp(&buf[0], Ethernet_MAC_Address, 6) != 0) && - (memcmp(&buf[0], Ethernet_Broadcast, 6) != 0)) { - return 0; - } - - (void)decode_unsigned16(&buf[12], &pdu_len); - pdu_len -= 3 /* DSAP, SSAP, LLC Control */; - /* copy the buffer into the PDU */ - if (pdu_len < max_pdu) { - memmove(&pdu[0], &buf[17], pdu_len); - } - /* ignore packets that are too large */ - else { - pdu_len = 0; - } - - return pdu_len; -} - -void ethernet_set_my_address(const BACNET_ADDRESS *my_address) -{ - int i = 0; - - for (i = 0; i < 6; i++) { - Ethernet_MAC_Address[i] = my_address->mac[i]; - } - - return; -} - -void ethernet_get_my_address(BACNET_ADDRESS *my_address) -{ - int i = 0; - - my_address->mac_len = 0; - for (i = 0; i < 6; i++) { - my_address->mac[i] = Ethernet_MAC_Address[i]; - my_address->mac_len++; - } - my_address->net = 0; /* DNET=0 is local only, no routing */ - my_address->len = 0; - for (i = 0; i < MAX_MAC_LEN; i++) { - my_address->adr[i] = 0; - } - - return; -} - -void ethernet_get_broadcast_address(BACNET_ADDRESS *dest) -{ /* destination address */ - int i = 0; /* counter */ - - if (dest) { - for (i = 0; i < 6; i++) { - dest->mac[i] = Ethernet_Broadcast[i]; - } - dest->mac_len = 6; - dest->net = BACNET_BROADCAST_NETWORK; - dest->len = 0; /* always zero when DNET is broadcast */ - for (i = 0; i < MAX_MAC_LEN; i++) { - dest->adr[i] = 0; - } - } - - return; -} diff --git a/ports/rx62n/hardware.h b/ports/rx62n/hardware.h deleted file mode 100644 index d9aa2b6f..00000000 --- a/ports/rx62n/hardware.h +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef HARDWARE_H -#define HARDWARE_H - -/* IO Port RPDL function definitions */ -#include "r_pdl_io_port.h" -/* CMT RPDL function definitions */ -#include "r_pdl_cmt.h" -/* General RPDL function definitions */ -#include "r_pdl_definitions.h" -/* Evaluation Board Definitions */ -#include "YRDKRX62N.h" -/* Ethernet driver */ -#include "r_ether.h" -/* LCD Driver */ -#include "lcd.h" - -/* there are 4..15 LEDs on the board */ -#define MAX_LEDS 16 -/* use the LEDS as binary outputs */ -#define MAX_BINARY_OUTPUTS 16 - -#endif diff --git a/ports/rx62n/led.c b/ports/rx62n/led.c deleted file mode 100644 index 782d41ac..00000000 --- a/ports/rx62n/led.c +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#include -#include "hardware.h" -#include "bacnet/basic/sys/mstimer.h" -#include "led.h" - -static struct mstimer Off_Delay_Timer[MAX_LEDS]; -static bool LED_Status[MAX_LEDS]; - -#define LED_OFF (0) - -/************************************************************************* - * Description: Turn on an LED - * Returns: none - * Notes: none - *************************************************************************/ -void led_on(uint8_t index) -{ - switch (index) { - case 4: - R_IO_PORT_Write(LED4, LED_ON); - break; - case 5: - R_IO_PORT_Write(LED5, LED_ON); - break; - case 6: - R_IO_PORT_Write(LED6, LED_ON); - break; - case 7: - R_IO_PORT_Write(LED7, LED_ON); - break; - case 8: - R_IO_PORT_Write(LED8, LED_ON); - break; - case 9: - R_IO_PORT_Write(LED9, LED_ON); - break; - case 10: - R_IO_PORT_Write(LED10, LED_ON); - break; - case 11: - R_IO_PORT_Write(LED11, LED_ON); - break; - case 12: - R_IO_PORT_Write(LED12, LED_ON); - break; - case 13: - R_IO_PORT_Write(LED13, LED_ON); - break; - case 14: - R_IO_PORT_Write(LED14, LED_ON); - break; - case 15: - R_IO_PORT_Write(LED15, LED_ON); - break; - default: - break; - } - if (index < MAX_LEDS) { - LED_Status[index] = LED_ON; - mstimer_set(&Off_Delay_Timer[index], 0); - } -} - -/************************************************************************* - * Description: Turn off an LED - * Returns: none - * Notes: none - *************************************************************************/ -void led_off(uint8_t index) -{ - switch (index) { - case 4: - R_IO_PORT_Write(LED4, LED_OFF); - break; - case 5: - R_IO_PORT_Write(LED5, LED_OFF); - break; - case 6: - R_IO_PORT_Write(LED6, LED_OFF); - break; - case 7: - R_IO_PORT_Write(LED7, LED_OFF); - break; - case 8: - R_IO_PORT_Write(LED8, LED_OFF); - break; - case 9: - R_IO_PORT_Write(LED9, LED_OFF); - break; - case 10: - R_IO_PORT_Write(LED10, LED_OFF); - break; - case 11: - R_IO_PORT_Write(LED11, LED_OFF); - break; - case 12: - R_IO_PORT_Write(LED12, LED_OFF); - break; - case 13: - R_IO_PORT_Write(LED13, LED_OFF); - break; - case 14: - R_IO_PORT_Write(LED14, LED_OFF); - break; - case 15: - R_IO_PORT_Write(LED15, LED_OFF); - break; - default: - break; - } - if (index < MAX_LEDS) { - LED_Status[index] = LED_OFF; - mstimer_set(&Off_Delay_Timer[index], 0); - } -} - -/************************************************************************* - * Description: Get the state of the LED - * Returns: true if on, false if off. - * Notes: none - *************************************************************************/ -bool led_state(uint8_t index) -{ - bool state = false; - - if (index < MAX_LEDS) { - state = LED_Status[index]; - } - - return state; -} - -/************************************************************************* - * Description: Toggle the state of the setup LED - * Returns: none - * Notes: none - *************************************************************************/ -void led_toggle(uint8_t index) -{ - if (led_state(index)) { - led_off(index); - } else { - led_on(index); - } -} - -/************************************************************************* - * Description: Delay before going off to give minimum brightness. - * Returns: none - * Notes: none - *************************************************************************/ -void led_off_delay(uint8_t index, uint32_t delay_ms) -{ - if (index < MAX_LEDS) { - mstimer_set(&Off_Delay_Timer[index], delay_ms); - } -} - -/************************************************************************* - * Description: Turn on, and delay before going off. - * Returns: none - * Notes: none - *************************************************************************/ -void led_on_interval(uint8_t index, uint16_t interval_ms) -{ - if (index < MAX_LEDS) { - led_on(index); - mstimer_set(&Off_Delay_Timer[index], interval_ms); - } -} - -/************************************************************************* - * Description: Task for blinking LED - * Returns: none - * Notes: none - *************************************************************************/ -void led_task(void) -{ - uint8_t i; /* loop counter */ - - for (i = 0; i < MAX_LEDS; i++) { - if (mstimer_interval(&Off_Delay_Timer[i]) > 0) { - if (mstimer_expired(&Off_Delay_Timer[i])) { - mstimer_set(&Off_Delay_Timer[i], 0); - led_off(i); - } - } - } -} - -/************************************************************************* - * Description: Initialize the LED hardware - * Returns: none - * Notes: none - *************************************************************************/ -void led_init(void) -{ - unsigned i = 0; - - for (i = 0; i < MAX_LEDS; i++) { - led_on_interval(i, 500); - } -} diff --git a/ports/rx62n/led.h b/ports/rx62n/led.h deleted file mode 100644 index c809826c..00000000 --- a/ports/rx62n/led.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2009 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *********************************************************************/ -#ifndef LED_H -#define LED_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -void led_on(uint8_t index); -void led_on_interval(uint8_t index, uint16_t interval_ms); -void led_off(uint8_t index); -void led_off_delay(uint8_t index, uint32_t delay_ms); -void led_toggle(uint8_t index); -bool led_state(uint8_t index); -void led_task(void); -void led_init(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif diff --git a/ports/rx62n/main.c b/ports/rx62n/main.c deleted file mode 100644 index 6a4a846d..00000000 --- a/ports/rx62n/main.c +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************ - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - * - *************************************************************************/ -#include -#include -#include "hardware.h" -#include "bacnet/datalink/ethernet.h" -#include "bacnet/basic/sys/mstimer.h" -#include "led.h" - -/** Main function of BACnet demo for RX62N evaluation board */ -int main(void) -{ - InitialiseLCD(); - ClearLCD(); - DisplayLCD(LCD_LINE1, "BACnet Demo"); - /* our stuff */ - timer_init(); - led_init(); - ethernet_init(NULL); - bacnet_init(); - for (;;) { - bacnet_task(); - led_task(); - } -} diff --git a/ports/rx62n/mstimer-init.c b/ports/rx62n/mstimer-init.c deleted file mode 100644 index 3bf7fc92..00000000 --- a/ports/rx62n/mstimer-init.c +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2011 Steve Karg - * - * SPDX-License-Identifier: MIT - *********************************************************************/ -#include -#include -#include "hardware.h" -#include "bacnet/basic/sys/mstimer.h" - -/* counter for the the timer which wraps every 49.7 days */ -static volatile uint32_t Millisecond_Counter; -/* forward prototype for interrupt service routine */ -void int_cmt0_isr(void); - -/************************************************************************* - * Description: Timer Interrupt Handler - * Returns: nothing - * Notes: none - *************************************************************************/ -static void timer_interrupt_handler(void) -{ - Millisecond_Counter++; -} - -/************************************************************************* - * Description: Timer Interrupt Service Routine - * Returns: nothing - * Notes: none - *************************************************************************/ -void int_cmt0_isr(void) -{ - timer_interrupt_handler(); -} - -/************************************************************************* - * Description: returns the current millisecond count - * Returns: none - * Notes: This method only disables the timer overflow interrupt. - *************************************************************************/ -unsigned long mstimer_now(void) -{ - unsigned long timer_value; /* return value */ - - timer_value = Millisecond_Counter; - - return timer_value; -} - -/************************************************************************* - * Description: Initialization for Timer - * Returns: none - * Notes: none - *************************************************************************/ -void timer_init(void) -{ - /* Declare error flag */ - bool err = true; - - /* CMT is configured for a 1ms interval, and executes the callback - function CB_CompareMatch on every compare match */ - err &= R_CMT_Create(3, PDL_CMT_PERIOD, 1E-3, int_cmt0_isr, 3); - - /* Halt in while loop when RPDL errors detected */ - while (!err) - ; -} diff --git a/ports/rx62n/readme.txt b/ports/rx62n/readme.txt deleted file mode 100644 index 97c424f8..00000000 --- a/ports/rx62n/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -BACnet Etherent -Demonstrates the Ethernet peripheral by implmenting BACnet over Ethernet -on the RX62N Development Kit. The project is compiled with the RX Standard -Toolchain, and the default drivers included with the RX62N kit. -  -The project does not use any additional hardware. -  -The project was tested using a BACnet/IP to BACnet Ethernet router, -using the bacnet-tools from the BACnet Protocol Stack site. diff --git a/ports/uip/.clang-format b/ports/uip/.clang-format deleted file mode 100644 index 579a192a..00000000 --- a/ports/uip/.clang-format +++ /dev/null @@ -1,7 +0,0 @@ ---- -# Disable formatting for now as there is external code. We should move external -# code to a separate directory and enable formatting for our code. -DisableFormat: true - -# DisableFormat will not disable include sorting with some versions. -SortIncludes: Never diff --git a/ports/uip/_stdint.h b/ports/uip/_stdint.h deleted file mode 100644 index f7f58ffe..00000000 --- a/ports/uip/_stdint.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Defines the standard integer types that are used in code */ - -#ifndef STDINT_H -#define STDINT_H - -#include - -typedef unsigned char uint8_t; /* 1 byte 0 to 255 */ -typedef signed char int8_t; /* 1 byte -127 to 127 */ -typedef unsigned short uint16_t; /* 2 bytes 0 to 65535 */ -typedef signed short int16_t; /* 2 bytes -32767 to 32767 */ -/*typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215 */ -typedef unsigned long uint32_t; /* 4 bytes 0 to 4294967295 */ -typedef signed long int32_t; /* 4 bytes -2147483647 to 2147483647 */ -/* typedef signed long long int64_t; */ -/* typedef unsigned long long uint64_t; */ - -#endif /* STDINT_H */ diff --git a/ports/uip/bip.c b/ports/uip/bip.c deleted file mode 100644 index fdde213b..00000000 --- a/ports/uip/bip.c +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2005 Steve Karg - * - * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 - * - *********************************************************************/ -#include /* for standard integer types uint8_t etc. */ -#include /* for the standard bool type. */ -#include "bacnet/bacdcode.h" -#include "bacnet/datalink/bip.h" -#include "eth.h" -#include "bacport.h" /* custom per port */ - -static int BIP_Socket = -1; -/* port to use - stored in host byte order */ -static uint16_t BIP_Port = 0xBAC0U; -/* broadcast destination port to use */ -static uint16_t BIP_Broadcast_Port; -/* IP Address - stored in host byte order */ -static struct in_addr BIP_Address; -/* Broadcast Address - stored in host byte order */ -static struct in_addr BIP_Broadcast_Address; - -void bip_set_socket(int sock_fd) -{ - BIP_Socket = sock_fd; -} - -int bip_socket(void) -{ - return BIP_Socket; -} - -bool bip_valid(void) -{ - return (BIP_Socket != -1); -} - -void bip_cleanup(void) -{ - /* if (bip_valid()) */ - /* close(BIP_Socket); */ - BIP_Socket = -1; - BIP_Broadcast_Port = 0; - - return; -} - -/* set using network byte order */ -void bip_set_addr(uint32_t net_address) -{ - /* BIP_Address.s_addr = ntohl(net_address); */ - BIP_Address.s_addr = net_address; -} - -/* returns host byte order */ -uint32_t bip_get_addr(void) -{ - return BIP_Address.s_addr; -} - -/* set using network byte order */ -void bip_set_broadcast_addr(uint32_t net_address) -{ - /* BIP_Broadcast_Address.s_addr = ntohl(net_address); */ - BIP_Broadcast_Address.s_addr = net_address; -} - -/* returns host byte order */ -uint32_t bip_get_broadcast_addr(void) -{ - return BIP_Broadcast_Address.s_addr; -} - -/* set using host byte order */ -void bip_set_port(uint16_t port) -{ - BIP_Port = port; -} - -/* set using host byte order */ -void bip_set_broadcast_port(uint16_t port) -{ - BIP_Broadcast_Port = port; -} - -/* returns host byte order */ -uint16_t bip_get_port(void) -{ - return BIP_Port; -} - -/* returns host byte order */ -uint16_t bip_get_broadcast_port(void) -{ - if (BIP_Broadcast_Port) { - return BIP_Broadcast_Port; - } - - return BIP_Port; -} - -/* function to send a packet out the BACnet/IP socket (Annex J) */ -/* returns number of bytes sent on success, negative number on failure */ -int bip_send_pdu(BACNET_ADDRESS *dest, /* destination address */ - BACNET_NPDU_DATA *npdu_data, /* network information */ - uint8_t *pdu, /* any data to be sent - may be null */ - unsigned pdu_len) -{ /* number of bytes of data */ - - struct sockaddr_in bip_dest; - uint8_t mtu[4]; - int mtu_len = 0; - int bytes_sent = 0; - UDP_HDR udphdr; - IP_HDR iphdr; - uint8_t mac[6]; - - (void)npdu_data; - - /* assumes that the driver has already been initialized */ - /* if (BIP_Socket < 0) */ - /* return BIP_Socket; */ - - mtu[0] = BVLL_TYPE_BACNET_IP; - bip_dest.sin_family = AF_INET; - - if (dest->mac_len == 6) { - memcpy(&(bip_dest.sin_addr.s_addr), &dest->mac[0], 4); - decode_unsigned16(&dest->mac[4], &(bip_dest.sin_port)); - memset(&(bip_dest.sin_zero), '\0', 8); - mtu[1] = BVLC_ORIGINAL_UNICAST_NPDU; - } - /* broadcast */ - else if (dest->mac_len == 0) { - bip_dest.sin_addr.s_addr = BIP_Broadcast_Address.s_addr; - bip_dest.sin_port = htons(bip_get_broadcast_port()); - memset(&(bip_dest.sin_zero), '\0', 8); - mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU; - } else - return -1; - - mtu_len = 2; - mtu_len += encode_unsigned16( - &mtu[mtu_len], (uint16_t)(pdu_len + 4 /*inclusive */)); - mtu_len += pdu_len; - - /* IP address should be in network byte order */ - ARPIsResolved(bip_dest.sin_addr.s_addr, mac); - - iphdr.vhl = 0x45; - iphdr.tos = 0; - iphdr.iplen = htons(mtu_len + sizeof(IP_HDR) + sizeof(UDP_HDR)); - ++ipid; - iphdr.ipid = htons(ipid); - iphdr.ipoffset[0] = iphdr.ipoffset[1] = 0; - iphdr.ttl = UIP_TTL; - iphdr.proto = UIP_PROTO_UDP; - iphdr.ipchksum = 0; - iphdr.srcipaddr = BIP_Address.s_addr; - iphdr.destipaddr = bip_dest.sin_addr.s_addr; - - /* Calculate IP checksum. */ - iphdr.ipchksum = ~(ip_getchksum((uint8_t *)&iphdr)); - - /* Ports are sent in Network byte order. BIP_Port is stored in Host byte - * order */ - udphdr.srcport = htons(BIP_Port); - udphdr.destport = bip_dest.sin_port; - udphdr.udplen = htons(mtu_len + sizeof(UDP_HDR)); - /* Not using UDP checksums */ - udphdr.udpchksum = 0; - - EthernetSendHeader(mac, UIP_ETHTYPE_IP); - EthernetSend((uint8_t *)&iphdr, sizeof(IP_HDR)); - EthernetSend((uint8_t *)&udphdr, sizeof(UDP_HDR)); - EthernetSend(mtu, 4); - EthernetSend(pdu, pdu_len); - EthernetFlush(); - uip_stat.ip.sent++; -} - -/* receives a BACnet/IP packet */ -/* returns the number of octets in the PDU, or zero on failure */ -uint16_t bip_receive(BACNET_ADDRESS *src, /* source address */ - uint8_t *pdu, /* PDU data */ - uint16_t max_pdu, /* amount of space available in the PDU */ - unsigned timeout) -{ /* number of milliseconds to wait for a packet */ - return 0; -} - -void bip_get_my_address(BACNET_ADDRESS *my_address) -{ - int i = 0; - - my_address->mac_len = 6; - (void)encode_unsigned32(&my_address->mac[0], htonl(BIP_Address.s_addr)); - (void)encode_unsigned16(&my_address->mac[4], htons(BIP_Port)); - my_address->net = 0; /* local only, no routing */ - my_address->len = 0; /* no SLEN */ - for (i = 0; i < MAX_MAC_LEN; i++) { - /* no SADR */ - my_address->adr[i] = 0; - } - - return; -} - -void bip_get_broadcast_address(BACNET_ADDRESS *dest) -{ /* destination address */ - int i = 0; /* counter */ - - if (dest) { - dest->mac_len = 6; - (void)encode_unsigned32( - &dest->mac[0], htonl(BIP_Broadcast_Address.s_addr)); - (void)encode_unsigned16( - &dest->mac[4], htons(bip_get_broadcast_port())); - dest->net = BACNET_BROADCAST_NETWORK; - dest->len = 0; /* no SLEN */ - for (i = 0; i < MAX_MAC_LEN; i++) { - /* no SADR */ - dest->adr[i] = 0; - } - } - - return; -} diff --git a/ports/uip/net.h b/ports/uip/net.h deleted file mode 100644 index 9509e2dd..00000000 --- a/ports/uip/net.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************** -* -* Copyright (C) 2005 Steve Karg -* -* SPDX-License-Identifier: MIT -* -*********************************************************************/ - -#ifndef NET_H -#define NET_H - -#include "stdint.h" - -struct sockaddr { - uint16_t sa_family; - char sa_data[14]; -}; - - -struct in_addr { - uint32_t s_addr; /* load with inet_aton() */ -}; - -struct sockaddr_in { - int16_t sin_family; /* e.g. AF_INET */ - uint16_t sin_port; /* e.g. htons(3490) */ - struct in_addr sin_addr; /* see struct in_addr, below */ - char sin_zero[8]; /* zero this if you want to */ -}; - - -typedef int socklen_t; - -/** - * Convert 16-bit quantity from host byte order to network byte order. - * - * This macro is primarily used for converting constants from host - * byte order to network byte order. For converting variables to - * network byte order, use the htons() function instead. - * - * \hideinitializer - */ -#ifndef htons -#define htons(n) ((((uint16_t)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8)) -#endif /* HTONS */ - -#define ntohs(n) (((((uint16_t)(n) & 0xFF)) << 8) | (((uint16_t)(n) & 0xFF00) >> 8)) -#define htonl(n) (((((uint32_t)(n) & 0xFF)) << 24) | \ - ((((uint32_t)(n) & 0xFF00)) << 8) | \ - ((((uint32_t)(n) & 0xFF0000)) >> 8) | \ - ((((uint32_t)(n) & 0xFF000000)) >> 24)) - -#define ntohl(n) (((((uint32_t)(n) & 0xFF)) << 24) | \ - ((((uint32_t)(n) & 0xFF00)) << 8) | \ - ((((uint32_t)(n) & 0xFF0000)) >> 8) | \ - ((((uint32_t)(n) & 0xFF000000)) >> 24)) - - -#define AF_UNIX 1 /* local to host (pipes, portals) */ -#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ -#define AF_IMPLINK 3 /* arpanet imp addresses */ -#define AF_PUP 4 /* pup protocols: e.g. BSP */ -#define AF_CHAOS 5 /* mit CHAOS protocols */ -#define AF_NS 6 /* XEROX NS protocols */ -#define AF_IPX AF_NS /* IPX protocols: IPX, SPX, etc. */ -#define AF_ISO 7 /* ISO protocols */ -#define AF_OSI AF_ISO /* OSI is ISO */ -#define AF_ECMA 8 /* european computer manufacturers */ -#define AF_DATAKIT 9 /* datakit protocols */ -#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ -#define AF_SNA 11 /* IBM SNA */ -#define AF_DECnet 12 /* DECnet */ -#define AF_DLI 13 /* Direct data link interface */ -#define AF_LAT 14 /* LAT */ -#define AF_HYLINK 15 /* NSC Hyperchannel */ -#define AF_APPLETALK 16 /* AppleTalk */ -#define AF_NETBIOS 17 /* NetBios-style addresses */ -#define AF_VOICEVIEW 18 /* VoiceView */ -#define AF_FIREFOX 19 /* Protocols from Firefox */ -#define AF_UNKNOWN1 20 /* Somebody is using this! */ -#define AF_BAN 21 /* Banyan */ -#define AF_ATM 22 /* Native ATM Services */ -#define AF_INET6 23 /* Internetwork Version 6 */ -#define AF_CLUSTER 24 /* Microsoft Wolfpack */ -#define AF_12844 25 /* IEEE 1284.4 WG AF */ -#define AF_IRDA 26 /* IrDA */ -#define AF_NETDES 28 /* Network Designers OSI & gateway - enabled protocols */ -#define AF_TCNPROCESS 29 -#define AF_TCNMESSAGE 30 -#define AF_ICLFXBM 31 - -#define AF_MAX 32 - -extern void set_address( - uint32_t * net_address, - uint8_t octet1, - uint8_t octet2, - uint8_t octet3, - uint8_t octet4); - -#endif diff --git a/ports/uip/stdbool.h b/ports/uip/stdbool.h deleted file mode 100644 index 71a283e0..00000000 --- a/ports/uip/stdbool.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef STDBOOL_H -#define STDBOOL_H - -/* C99 Boolean types for compilers without C99 support */ - -#ifndef __cplusplus - -/*typedef int _Bool; */ -#ifndef bool -#define bool _Bool -#endif -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif -#define __bool_true_false_are_defined 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#endif