adjust root folder
This commit is contained in:
@@ -0,0 +1,310 @@
|
||||
[HIMDBVersion]
|
||||
2.0
|
||||
[DATABASE_VERSION]
|
||||
"2.8"
|
||||
[PROJECT_DETAILS]
|
||||
"BACnet_Ethernet_RX62N" "C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N" "C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N.hwp" "RX" "Renesas RX Standard" "Application" "" ""
|
||||
[INFORMATION]
|
||||
"No project information available"
|
||||
[TOOL_CHAIN]
|
||||
"Renesas RX Standard Toolchain" "1.0.1.0"
|
||||
[CONFIGURATIONS]
|
||||
"Debug" "C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\Debug"
|
||||
[BUILD_PHASES]
|
||||
"Renesas OptLinker" 1
|
||||
"Renesas RX Assembler" 1
|
||||
"Renesas RX C/C++ Compiler" 1
|
||||
"Renesas RX C/C++ Library Generator" 1
|
||||
"Renesas RX Configurator" 1
|
||||
[TOOL_ENVIRONMENT]
|
||||
[EXTENSIONS]
|
||||
"Absolute file" "ABS"
|
||||
"Assembly include file" "INC"
|
||||
"Assembly list file" "LST"
|
||||
"Assembly source file" "S"
|
||||
"Assembly source file" "SRC"
|
||||
"Binary file" "BIN"
|
||||
"C header file" "H"
|
||||
"C source file" "C"
|
||||
"C++ header file" "HPP"
|
||||
"C++ source file" "CC"
|
||||
"C++ source file" "CP"
|
||||
"C++ source file" "CPP"
|
||||
"CPU information file" "CPU"
|
||||
"Calling information file" "CAL"
|
||||
"Configuration file" "CFG"
|
||||
"Debug information file" "DBG"
|
||||
"Hex file" "HEX"
|
||||
"Library file" "LIB"
|
||||
"Library information file" "LBP"
|
||||
"Linkage map file" "MAP"
|
||||
"Linkage symbol file" "FSY"
|
||||
"Object file" "OBJ"
|
||||
"Optimize map file" "bls"
|
||||
"Preprocessed C source file" "P"
|
||||
"Preprocessed C++ source file" "PP"
|
||||
"Relocatable file" "REL"
|
||||
"Rts information file" "RTS"
|
||||
"S-Record file" "MOT"
|
||||
"Stack information file" "SNI"
|
||||
"TD include object file" "RTI"
|
||||
[FILE_GROUPS]
|
||||
"Absolute file" "BIN" "NONE" ""
|
||||
"Assembly include file" "TEXT" "EDITOR" ""
|
||||
"Assembly list file" "TEXT" "EDITOR" ""
|
||||
"Assembly source file" "TEXT" "EDITOR" ""
|
||||
"Binary file" "BIN" "NONE" ""
|
||||
"C header file" "TEXT" "EDITOR" ""
|
||||
"C source file" "TEXT" "EDITOR" ""
|
||||
"C++ header file" "TEXT" "EDITOR" ""
|
||||
"C++ source file" "TEXT" "EDITOR" ""
|
||||
"CPU information file" "BIN" "NONE" ""
|
||||
"Calling information file" "BIN" "NONE" ""
|
||||
"Configuration file" "TEXT" "EDITOR" ""
|
||||
"Debug information file" "BIN" "NONE" ""
|
||||
"Hex file" "TEXT" "EDITOR" ""
|
||||
"Library file" "BIN" "NONE" ""
|
||||
"Library information file" "TEXT" "EDITOR" ""
|
||||
"Linkage map file" "TEXT" "EDITOR" ""
|
||||
"Linkage symbol file" "TEXT" "EDITOR" ""
|
||||
"Object file" "BIN" "NONE" ""
|
||||
"Optimize map file" "BIN" "NONE" ""
|
||||
"Preprocessed C source file" "TEXT" "EDITOR" ""
|
||||
"Preprocessed C++ source file" "TEXT" "EDITOR" ""
|
||||
"Relocatable file" "BIN" "NONE" ""
|
||||
"Rts information file" "BIN" "NONE" ""
|
||||
"S-Record file" "TEXT" "EDITOR" ""
|
||||
"Stack information file" "BIN" "NONE" ""
|
||||
"TD include object file" "BIN" "NONE" ""
|
||||
[ASSOCIATED_APPLICATIONS]
|
||||
[TOOLCHAIN_PHASE]
|
||||
"Renesas OptLinker"
|
||||
"Renesas RX Assembler"
|
||||
"Renesas RX C/C++ Compiler"
|
||||
"Renesas RX C/C++ Library Generator"
|
||||
"Renesas RX Configurator"
|
||||
[UTILITY_PHASE]
|
||||
[CUSTOM_PHASES]
|
||||
[CUSTOM_PHASE_INPUT_GROUP]
|
||||
[CUSTOM_PHASE_OUTPUT_SYNTAX]
|
||||
[BUILD_ORDER]
|
||||
"Renesas RX C/C++ Library Generator" 1
|
||||
"Renesas RX C/C++ Compiler" 1
|
||||
"Renesas RX Assembler" 1
|
||||
"Renesas OptLinker" 1
|
||||
"Renesas RX Configurator" 0
|
||||
[BUILD_PHASE_DETAILS]
|
||||
"Renesas OptLinker" "Object file|Library file|Relocatable file" 0
|
||||
"Renesas RX Assembler" "Assembly source file|Linkage symbol file" 1
|
||||
"Renesas RX C/C++ Compiler" "C source file|C++ source file" 1
|
||||
"Renesas RX C/C++ Library Generator" "" 0
|
||||
"Renesas RX Configurator" "Configuration file" 0
|
||||
[BUILD_FILE_ORDER_Assembly source file]
|
||||
"Renesas RX Assembler" 1
|
||||
[BUILD_FILE_ORDER_C source file]
|
||||
"Renesas RX C/C++ Compiler" 1
|
||||
[BUILD_FILE_ORDER_C++ source file]
|
||||
"Renesas RX C/C++ Compiler" 1
|
||||
[BUILD_FILE_ORDER_Linkage symbol file]
|
||||
"Renesas RX Assembler" 1
|
||||
[SCRAP]
|
||||
"Project Generator Setup File" ""
|
||||
[MAPPINGS]
|
||||
"Assembly source file" "Renesas RX Assembler" "Renesas RX C/C++ Compiler"
|
||||
"Library file" "Renesas OptLinker" "Renesas RX C/C++ Library Generator"
|
||||
"Object file" "Renesas OptLinker" "Renesas RX Assembler"
|
||||
"Object file" "Renesas OptLinker" "Renesas RX C/C++ Compiler"
|
||||
[PROJECT_FILES]
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_dcc.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_npdu.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rd.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rp.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rpm.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_whohas.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_whois.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_wp.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\noserv.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\s_iam.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\s_ihave.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\txbuf.c" "User" "C source file|BACnet|Handler" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_ADC_10.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_ADC_12.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_BSC.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_CMT.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_DMAC.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_IIC.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_INTC.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_MTU.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_POE.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_SCI.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_SPI.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_TMR.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_WDT.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_not_RPDL.c" "User" "C source file|RPDL" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\bacnet.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\bacnet.h" "User" "C header file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\bo.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\device.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\ethernet.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\hardware.h" "User" "C header file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\led.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\led.h" "User" "C header file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\main.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\timer-hdw.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\timer.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\timer.h" "User" "C header file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\GlyphLib_v2.lib" "User" "Library file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\YRDKRX62N_RSPI_API.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\dbsct.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\hwsetup.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\lcd.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\resetprg.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\sbrk.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\switch.c" "User" "C source file|bsp" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\driver\phy.c" "User" "C source file|driver" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\driver\r_ether.c" "User" "C source file|driver" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\abort.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\apdu.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacapp.c" "User" "C source file" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacdcode.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacerror.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacint.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacprop.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacreal.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacstr.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\datetime.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\dcc.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\iam.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\ihave.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\memcopy.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\npdu.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rd.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\reject.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rp.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rpm.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\version.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\whohas.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\whois.c" "User" "C source file|BACnet|Core" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\wp.c" "User" "C source file|BACnet|Core" 2
|
||||
[FOLDER]
|
||||
"C header file" "C header file"
|
||||
"C source file" "C source file"
|
||||
"C source file|BACnet" ""
|
||||
"C source file|BACnet|Core" ""
|
||||
"C source file|BACnet|Handler" ""
|
||||
"C source file|RPDL" ""
|
||||
"C source file|bsp" ""
|
||||
"C source file|driver" ""
|
||||
"C source file|user-app" ""
|
||||
"Library file" "Library file"
|
||||
[GENERAL_DATA_PROJECT]
|
||||
"USE_CUSTOM_LINKAGE_ORDER" "0"
|
||||
[ON_DEMAND_COMPONENTS_LOADED]
|
||||
[SYNC_SESSION_NAMES]
|
||||
[SESSIONS]
|
||||
"DefaultSession" "C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\DefaultSession.hsf" 0
|
||||
"JLink" "C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\JLink.hsf" 0
|
||||
[GENERAL_DATA_SESSION_DefaultSession]
|
||||
[GENERAL_DATA_SESSION_JLink]
|
||||
[OPTIONS_Debug_Renesas OptLinker]
|
||||
"Single Shot" "0c5147307f9dbc10" 5
|
||||
[OPTIONS_Debug_Renesas RX Assembler]
|
||||
"Assembly source file" "091c6ad95f42bc10" 4
|
||||
"Linkage symbol file" "091c6ad95f42bc10" 4
|
||||
[OPTIONS_Debug_Renesas RX C/C++ Compiler]
|
||||
"C source file" "0e4b370aaf9dbc10" 2
|
||||
"C++ source file" "0e4b370aaf9dbc10" 3
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_dcc.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_npdu.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rd.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rp.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_rpm.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_whohas.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_whois.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\h_wp.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\noserv.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\s_iam.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\s_ihave.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\demo\handler\txbuf.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_ADC_10.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_ADC_12.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_BSC.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_CMT.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_DMAC.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_IIC.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_INTC.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_MTU.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_POE.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_SCI.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_SPI.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_TMR.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_WDT.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\RPDL\Interrupt_not_RPDL.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\bacnet.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\bo.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\device.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\ethernet.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\led.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\main.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\timer-hdw.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bacnet\timer.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\YRDKRX62N_RSPI_API.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\dbsct.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\hwsetup.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\lcd.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\resetprg.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\sbrk.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\bsp\switch.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\driver\phy.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\ports\rx62n\BACnet_Ethernet_RX62N\BACnet_Ethernet_RX62N\src\driver\r_ether.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\abort.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\apdu.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacapp.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacdcode.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacerror.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacint.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacprop.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacreal.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\bacstr.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\datetime.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\dcc.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\iam.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\ihave.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\memcopy.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\npdu.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rd.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\reject.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rp.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\rpm.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\version.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\whohas.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\whois.c" "0e4b370aaf9dbc10" 2
|
||||
"C:\Documents and Settings\VMWare\My Documents\bacnet-stack\src\wp.c" "0e4b370aaf9dbc10" 2
|
||||
[OPTIONS_Debug_Renesas RX C/C++ Library Generator]
|
||||
"Single Shot" "0bffac16d909bc10" 1
|
||||
[OPTIONS_Debug_Renesas RX Configurator]
|
||||
"Single Shot" "0f2016307f9dbc10" 6
|
||||
[OPTIONS_Debug]
|
||||
"" 0
|
||||
"[V|VERSION|1] [B|COMMAND|1] [S|SPEC|UITRON4] [S|OUTPUTPATH|^"$(CONFIGDIR)^"] [S|CPU|RX600] [S|ENDIAN|LITTLE] [S|FINT_REGISTER|0] [S|PATCH|RX610]" 6
|
||||
"[V|VERSION|1] [B|DEBUG|1] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).obj^"] [B|LISTFILE|0] [S|CPU|RX600] [S|ENDIAN|LITTLE] [S|FINT_REGISTER|0] [S|PATCH|RX610]" 4
|
||||
"[V|VERSION|1] [S|LANG|CPP] [B|SJIS|1] [S|INCLUDE|^"$(PROJDIR)\src\bacnet^"|^"$(PROJDIR)\..\..\..\..\include^"|^"$(PROJDIR)\src\bsp^"|^"$(PROJDIR)\src\driver^"|^"$(PROJDIR)\src\RPDL^"] [S|DEFINE|BACDL_ETHERNET|MAX_TSM_TRANSACTIONS=0|MAX_CHARACTER_STRING_BYTES=64|MAX_OCTET_STRING_BYTES=64] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).obj^"] [B|DEBUG|1] [S|OPTIMIZE|0] [B|SIZE|1] [B|MAP|0] [I|INLINE|100] [I|LOOP|2] [S|MISRA2004_CHECK_RULE|ALL] [S|MISRA2004_RULE|1.1|3.4|4.1|5.2|5.3|5.4|5.5|5.6|5.7|6.1|6.2|6.3|6.4|6.5|7.1|8.1|8.2|8.3|8.5|8.6|8.7|8.8|8.11|8.12|9.2|9.3|10.1|10.2|10.3|10.4|10.5|10.6|11.1|11.2|11.3|11.4|11.5|12.1|12.2|12.3|12.4|12.5|12.6|12.7|12.8|12.9|12.10|12.11|12.12|12.13|13.1|13.2|13.3|13.4|13.7|14.1|14.2|14.3|14.4|14.5|14.6|14.7|14.8|14.9|14.10|15.1|15.2|15.3|15.4|15.5|16.1|16.2|16.3|16.4|16.5|16.6|16.8|16.9|17.3|17.4|17.5|17.6|18.1|18.2|18.4|19.1|20.2|20.4|20.5|20.7|20.8|20.9|20.10|20.11|20.12] [S|MISRA1998_CHECK_RULE|ALL] [S|MISRA1998_RULE|1|5|8|12|13|14|17|18|19|20|21|22|24|28|29|31|32|33|34|35|36|37|38|39|40|42|43|44|45|46|48|49|50|51|53|54|55|56|57|58|59|60|61|62|63|64|65|68|69|70|71|72|73|74|75|76|77|78|79|80|82|83|84|85|99|101|102|103|104|105|106|108|110|111|112|113|115|118|119|121|122|123|124|125|126|127] [S|MISRA_GROUP_FILE_PATH|^"$(PROJDIR)\$(PROJECTNAME).rde^"] [S|CPU|RX600] [S|BASE|00000000=NONE] [S|PATCH|RX610]
|
||||
" 3
|
||||
"[V|VERSION|1] [S|LANG|C] [B|SJIS|1] [S|INCLUDE|^"$(PROJDIR)\src\bacnet^"|^"$(PROJDIR)\..\..\..\..\include^"|^"$(PROJDIR)\src\bsp^"|^"$(PROJDIR)\src\driver^"|^"$(PROJDIR)\src\RPDL^"] [S|DEFINE|BACDL_ETHERNET|MAX_TSM_TRANSACTIONS=0] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(FILELEAF).obj^"] [B|DEBUG|1] [S|OPTIMIZE|0] [B|SIZE|1] [B|MAP|0] [I|INLINE|100] [I|LOOP|2] [S|MISRA2004_CHECK_RULE|ALL] [S|MISRA2004_RULE|1.1|3.4|4.1|5.2|5.3|5.4|5.5|5.6|5.7|6.1|6.2|6.3|6.4|6.5|7.1|8.1|8.2|8.3|8.5|8.6|8.7|8.8|8.11|8.12|9.2|9.3|10.1|10.2|10.3|10.4|10.5|10.6|11.1|11.2|11.3|11.4|11.5|12.1|12.2|12.3|12.4|12.5|12.6|12.7|12.8|12.9|12.10|12.11|12.12|12.13|13.1|13.2|13.3|13.4|13.7|14.1|14.2|14.3|14.4|14.5|14.6|14.7|14.8|14.9|14.10|15.1|15.2|15.3|15.4|15.5|16.1|16.2|16.3|16.4|16.5|16.6|16.8|16.9|17.3|17.4|17.5|17.6|18.1|18.2|18.4|19.1|20.2|20.4|20.5|20.7|20.8|20.9|20.10|20.11|20.12] [S|MISRA1998_CHECK_RULE|ALL] [S|MISRA1998_RULE|1|5|8|12|13|14|17|18|19|20|21|22|24|28|29|31|32|33|34|35|36|37|38|39|40|42|43|44|45|46|48|49|50|51|53|54|55|56|57|58|59|60|61|62|63|64|65|68|69|70|71|72|73|74|75|76|77|78|79|80|82|83|84|85|99|101|102|103|104|105|106|108|110|111|112|113|115|118|119|121|122|123|124|125|126|127] [S|MISRA_GROUP_FILE_PATH|^"$(PROJDIR)\$(PROJECTNAME).rde^"] [S|CPU|RX600] [S|BASE|00000000=NONE] [S|PATCH|RX610]
|
||||
" 2
|
||||
"[V|VERSION|1] [S|MODE|BUILD/CHANGED] [S|EXISTOUTPUTPATH|^"$(CONFIGDIR)\$(PROJECTNAME).lib^"] [B|RUNTIME|1] [B|STDIO|1] [B|STDLIB|1] [B|STRING|1] [B|NEW|1] [S|OUTPUTPATH|^"$(CONFIGDIR)\$(PROJECTNAME).lib^"] [B|SIZE|1] [I|INLINE|100] [I|LOOP|2] [S|CPU|RX600] [S|BASE|00000000=NONE] [S|PATCH|RX610]
|
||||
" 1
|
||||
"[V|VERSION|6] [S|INPUTLIBRARY|^"$(PROJDIR)\src\RPDL\RX62N_library.lib^"] [S|PRELINK|SKIP] [S|FORM|STYPE] [S|BYTE_COUNT_VALUE|FF] [B|DEBUG|1] [S|ROM|(D,R)|(D_1,R_1)|(D_2,R_2)] [S|CRC|NONE|DEFAULT|00000000] [S|SHOW|METHODCUSTOM|] [S|OUTPUT|^"$(CONFIGDIR)\$(PROJECTNAME).mot^"] [I|SPACE|^"FF^"] [B|OPTIMIZE|0] [S|START|B_RX_DESC,B_TX_DESC,B_RX_BUFF_1,B_TX_BUFF_1,B_1,R_1,B_2,R_2,B,R,SU,SI(01000)|PResetPRG,C_1,C_2,C,C$*,D*,P,W*(0FFF80000)|C_FLASH_CONFIG_PARAMS_1(0FFFFFF00)|FIXEDVECT(0FFFFFFD0)]
|
||||
" 5
|
||||
[EXCLUDED_FILES_Debug]
|
||||
[LINKAGE_ORDER_Debug]
|
||||
[GENERAL_DATA_CONFIGURATION_Debug]
|
||||
[GENERAL_DATA_CONFIGURATION_SESSION_Debug_DefaultSession]
|
||||
[SESSION_DATA_CONFIGURATION_SESSION_Debug_DefaultSession]
|
||||
"MEMORY_MAPPING_OPTIONS" ""
|
||||
[GENERAL_DATA_CONFIGURATION_SESSION_Debug_JLink]
|
||||
[SESSION_DATA_CONFIGURATION_SESSION_Debug_JLink]
|
||||
"MEMORY_MAPPING_OPTIONS" ""
|
||||
[EXT_DEBUGGER_INFO]
|
||||
0 "" "" "" ""
|
||||
[END]
|
||||
@@ -0,0 +1,120 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
/* hardware layer includes */
|
||||
#include "hardware.h"
|
||||
#include "timer.h"
|
||||
#include "led.h"
|
||||
/* BACnet Stack includes */
|
||||
#include "datalink.h"
|
||||
#include "npdu.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "dcc.h"
|
||||
#include "iam.h"
|
||||
#include "device.h"
|
||||
#include "bo.h"
|
||||
/* me */
|
||||
#include "bacnet.h"
|
||||
|
||||
/* timer for device communications control */
|
||||
static struct itimer 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 */
|
||||
timer_interval_start_seconds(&DCC_Timer, DCC_CYCLE_SECONDS);
|
||||
/* Hello World! */
|
||||
Send_I_Am(&Handler_Transmit_Buffer[0]);
|
||||
}
|
||||
|
||||
static uint8_t PDUBuffer[MAX_MPDU];
|
||||
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 (timer_interval_expired(&DCC_Timer)) {
|
||||
timer_interval_reset(&DCC_Timer);
|
||||
dcc_timer_seconds(DCC_CYCLE_SECONDS);
|
||||
}
|
||||
/* handle the messaging */
|
||||
pdu_len = datalink_receive(&src, &PDUBuffer[0], sizeof(PDUBuffer), 0);
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &PDUBuffer[0], pdu_len);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#ifndef BACNET_H
|
||||
#define BACNET_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void bacnet_init(
|
||||
void);
|
||||
void bacnet_task(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -0,0 +1,520 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
/* Binary Output Objects - customize for your use */
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacenum.h"
|
||||
#include "config.h" /* the custom stuff */
|
||||
#include "wp.h"
|
||||
#include "hardware.h"
|
||||
#include "led.h"
|
||||
#include "bo.h"
|
||||
#include "handlers.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 int 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 int Binary_Output_Properties_Optional[] = {
|
||||
PROP_ACTIVE_TEXT,
|
||||
PROP_INACTIVE_TEXT,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Binary_Output_Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
|
||||
void Binary_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **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_string[32]; /* okay for single thread */
|
||||
|
||||
if (object_instance < MAX_BINARY_OUTPUTS) {
|
||||
sprintf(text_string, "BO-%lu", object_instance);
|
||||
return text_string;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* 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 =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
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 =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_NULL,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
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 =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
if (status) {
|
||||
Binary_Output_Out_Of_Service_Set(wp_data->object_instance,
|
||||
value.type.Boolean);
|
||||
}
|
||||
break;
|
||||
case PROP_POLARITY:
|
||||
status =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
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;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,252 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#include <stdint.h> /* for standard integer types uint8_t etc. */
|
||||
#include <stdbool.h> /* for the standard bool type. */
|
||||
#include "bacdef.h"
|
||||
#include "ethernet.h"
|
||||
#include "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[MAX_MPDU] = { 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) > MAX_MPDU) {
|
||||
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[MAX_MPDU] = { 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(
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#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
|
||||
@@ -0,0 +1,235 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#include <stdint.h>
|
||||
#include "hardware.h"
|
||||
#include "timer.h"
|
||||
#include "led.h"
|
||||
|
||||
static struct itimer 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;
|
||||
timer_interval_no_expire(&Off_Delay_Timer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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;
|
||||
timer_interval_no_expire(&Off_Delay_Timer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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) {
|
||||
timer_interval_start(&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);
|
||||
timer_interval_start(&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 (timer_interval_expired(&Off_Delay_Timer[i])) {
|
||||
timer_interval_no_expire(&Off_Delay_Timer[i]);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#ifndef LED_H
|
||||
#define LED_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,48 @@
|
||||
/************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*************************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "hardware.h"
|
||||
#include "ethernet.h"
|
||||
#include "timer.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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
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.
|
||||
@@ -0,0 +1,102 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "hardware.h"
|
||||
#include "timer.h"
|
||||
|
||||
/* counter for the the timer which wraps every 49.7 days */
|
||||
static volatile uint32_t Millisecond_Counter;
|
||||
static volatile uint8_t Millisecond_Counter_Byte;
|
||||
/* 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++;
|
||||
Millisecond_Counter_Byte++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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.
|
||||
*************************************************************************/
|
||||
uint32_t timer_milliseconds(
|
||||
void)
|
||||
{
|
||||
uint32_t timer_value; /* return value */
|
||||
|
||||
timer_value = Millisecond_Counter;
|
||||
|
||||
return timer_value;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: returns the current millisecond count
|
||||
* Returns: none
|
||||
* Notes: This method only disables the timer overflow interrupt.
|
||||
*************************************************************************/
|
||||
uint8_t timer_milliseconds_byte(
|
||||
void)
|
||||
{
|
||||
return Millisecond_Counter;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "timer.h"
|
||||
|
||||
/* generic elapsed timer handling */
|
||||
/* interval not to exceed 49.7 days */
|
||||
/* interval of 1ms may be 0 to 1ms */
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Sets the start time for an elapsed timer
|
||||
* Returns: the value of the start timer
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_elapsed_start(
|
||||
struct etimer *t)
|
||||
{
|
||||
uint32_t now = timer_milliseconds();
|
||||
|
||||
if (t) {
|
||||
t->start = now;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Gets the amount of elapsed time in milliseconds
|
||||
* Returns: elapsed time in milliseconds
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
uint32_t timer_elapsed_time(
|
||||
struct etimer *t)
|
||||
{
|
||||
uint32_t now = timer_milliseconds();
|
||||
uint32_t delta = 0;
|
||||
|
||||
if (t) {
|
||||
delta = now - t->start;
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Sets the start time with an offset
|
||||
* Returns: elapsed time in milliseconds
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_elapsed_start_offset(
|
||||
struct etimer *t,
|
||||
uint32_t offset)
|
||||
{
|
||||
uint32_t now = timer_milliseconds();
|
||||
|
||||
if (t) {
|
||||
t->start = now + offset;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_milliseconds(
|
||||
struct etimer *t,
|
||||
uint32_t milliseconds)
|
||||
{
|
||||
return (timer_elapsed_time(t) >= milliseconds);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_seconds(
|
||||
struct etimer * t,
|
||||
uint32_t seconds)
|
||||
{
|
||||
uint32_t milliseconds = seconds;
|
||||
|
||||
milliseconds *= 1000L;
|
||||
|
||||
return timer_elapsed_milliseconds(t, milliseconds);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_minutes(
|
||||
struct etimer * t,
|
||||
uint32_t minutes)
|
||||
{
|
||||
uint32_t milliseconds = minutes;
|
||||
|
||||
milliseconds *= 1000L;
|
||||
milliseconds *= 60L;
|
||||
|
||||
return timer_elapsed_milliseconds(t, milliseconds);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_milliseconds_short(
|
||||
struct etimer * t,
|
||||
uint16_t value)
|
||||
{
|
||||
uint32_t milliseconds;
|
||||
|
||||
milliseconds = value;
|
||||
|
||||
return (timer_elapsed_time(t) >= milliseconds);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_seconds_short(
|
||||
struct etimer * t,
|
||||
uint16_t value)
|
||||
{
|
||||
return timer_elapsed_seconds(t, value);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_elapsed_minutes_short(
|
||||
struct etimer * t,
|
||||
uint16_t value)
|
||||
{
|
||||
return timer_elapsed_minutes(t, value);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Starts an interval timer
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_start(
|
||||
struct itimer *t,
|
||||
uint32_t interval)
|
||||
{
|
||||
if (t) {
|
||||
t->start = timer_milliseconds();
|
||||
t->interval = interval;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Starts an interval timer
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_start_seconds(
|
||||
struct itimer *t,
|
||||
uint32_t seconds)
|
||||
{
|
||||
uint32_t interval = seconds;
|
||||
|
||||
interval *= 1000L;
|
||||
timer_interval_start(t, interval);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Starts an interval timer
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_start_minutes(
|
||||
struct itimer *t,
|
||||
uint32_t minutes)
|
||||
{
|
||||
uint32_t interval = minutes;
|
||||
|
||||
interval *= 1000L;
|
||||
interval *= 60L;
|
||||
timer_interval_start(t, interval);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Determines the amount of time that has elapsed
|
||||
* Returns: elapsed milliseconds
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
uint32_t timer_interval_elapsed(
|
||||
struct itimer *t)
|
||||
{
|
||||
uint32_t now = timer_milliseconds();
|
||||
uint32_t delta = 0;
|
||||
|
||||
if (t) {
|
||||
delta = now - t->start;
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Determines the amount of time that has elapsed
|
||||
* Returns: elapsed milliseconds
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
uint32_t timer_interval(
|
||||
struct itimer * t)
|
||||
{
|
||||
uint32_t interval = 0;
|
||||
|
||||
if (t) {
|
||||
interval = t->interval;
|
||||
}
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Tests to see if time has elapsed
|
||||
* Returns: true if time has elapsed
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool timer_interval_expired(
|
||||
struct itimer * t)
|
||||
{
|
||||
bool expired = false;
|
||||
|
||||
if (t) {
|
||||
if (t->interval) {
|
||||
expired = timer_interval_elapsed(t) >= t->interval;
|
||||
}
|
||||
}
|
||||
|
||||
return expired;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Sets the interval value to zero so it never expires
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_no_expire(
|
||||
struct itimer *t)
|
||||
{
|
||||
if (t) {
|
||||
t->interval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Adds another interval to the start time. Used for cyclic
|
||||
* timers that won't lose ticks.
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_reset(
|
||||
struct itimer *t)
|
||||
{
|
||||
if (t) {
|
||||
t->start += t->interval;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Restarts the timer with the same interval
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void timer_interval_restart(
|
||||
struct itimer *t)
|
||||
{
|
||||
if (t) {
|
||||
t->start = timer_milliseconds();
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Return the elapsed time
|
||||
* Returns: number of milliseconds elapsed
|
||||
* Notes: only up to 255ms elapsed
|
||||
**************************************************************************/
|
||||
uint8_t timer_milliseconds_delta(
|
||||
uint8_t start)
|
||||
{
|
||||
return (timer_milliseconds_byte() - start);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Mark the start of a delta timer
|
||||
* Returns: mark timer starting tick
|
||||
* Notes: only up to 255ms elapsed
|
||||
**************************************************************************/
|
||||
uint8_t timer_milliseconds_mark(
|
||||
void)
|
||||
{
|
||||
return timer_milliseconds_byte();
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ctest.h"
|
||||
|
||||
static uint32_t Milliseconds;
|
||||
|
||||
uint32_t timer_milliseconds(
|
||||
void)
|
||||
{
|
||||
return Milliseconds;
|
||||
}
|
||||
|
||||
uint32_t timer_milliseconds_set(
|
||||
uint32_t value)
|
||||
{
|
||||
uint32_t old_value = Milliseconds;
|
||||
|
||||
Milliseconds = value;
|
||||
|
||||
return old_value;
|
||||
}
|
||||
|
||||
void testElapsedTimer(
|
||||
Test * pTest)
|
||||
{
|
||||
struct etimer t;
|
||||
uint32_t test_time = 0;
|
||||
|
||||
timer_milliseconds_set(test_time);
|
||||
timer_elapsed_start(&t);
|
||||
ct_test(pTest, timer_elapsed_time(&t) == test_time);
|
||||
test_time = 0xffff;
|
||||
timer_milliseconds_set(test_time);
|
||||
ct_test(pTest, timer_elapsed_time(&t) == test_time);
|
||||
test_time = 0xffffffff;
|
||||
timer_milliseconds_set(test_time);
|
||||
ct_test(pTest, timer_elapsed_time(&t) == test_time);
|
||||
}
|
||||
|
||||
void testIntervalTimer(
|
||||
Test * pTest)
|
||||
{
|
||||
struct itimer t;
|
||||
uint32_t interval = 0;
|
||||
uint32_t test_time = 0;
|
||||
|
||||
timer_milliseconds_set(test_time);
|
||||
timer_interval_start(&t, interval);
|
||||
test_time = 0xffff;
|
||||
timer_milliseconds_set(test_time);
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
ct_test(pTest, timer_interval_elapsed(&t) == test_time);
|
||||
test_time = 0xffffffff;
|
||||
timer_milliseconds_set(test_time);
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
ct_test(pTest, timer_interval_elapsed(&t) == test_time);
|
||||
test_time = 0;
|
||||
timer_milliseconds_set(test_time);
|
||||
interval = 0xffff;
|
||||
timer_interval_start(&t, interval);
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
interval = 0xffffffff;
|
||||
timer_interval_start(&t, interval);
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
|
||||
interval = 0;
|
||||
timer_interval_start_seconds(&t, interval);
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
interval = 60L;
|
||||
timer_interval_start_seconds(&t, interval);
|
||||
interval *= 1000L;
|
||||
ct_test(pTest, timer_interval(&t) == interval);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST_TIMER
|
||||
int main(
|
||||
void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("Timer", NULL);
|
||||
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testElapsedTimer);
|
||||
assert(rc);
|
||||
rc = ct_addTestFunction(pTest, testIntervalTimer);
|
||||
assert(rc);
|
||||
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void) ct_report(pTest);
|
||||
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*********************************************************************/
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Timer Module */
|
||||
|
||||
/* elapsed timer structure */
|
||||
struct etimer {
|
||||
uint32_t start;
|
||||
};
|
||||
/* interval timer structure */
|
||||
struct itimer {
|
||||
uint32_t start;
|
||||
uint32_t interval;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* these 3 functions are created in the hardware specific module */
|
||||
void timer_init(
|
||||
void);
|
||||
uint32_t timer_milliseconds(
|
||||
void);
|
||||
uint8_t timer_milliseconds_byte(
|
||||
void);
|
||||
|
||||
/* these functions are in the generic timer.c module */
|
||||
|
||||
/* elapsed timer */
|
||||
void timer_elapsed_start(
|
||||
struct etimer *t);
|
||||
void timer_elapsed_start_offset(
|
||||
struct etimer *t,
|
||||
uint32_t offset);
|
||||
uint32_t timer_elapsed_time(
|
||||
struct etimer *t);
|
||||
bool timer_elapsed_milliseconds(
|
||||
struct etimer *t,
|
||||
uint32_t value);
|
||||
bool timer_elapsed_seconds(
|
||||
struct etimer *t,
|
||||
uint32_t value);
|
||||
bool timer_elapsed_minutes(
|
||||
struct etimer *t,
|
||||
uint32_t value);
|
||||
bool timer_elapsed_milliseconds_short(
|
||||
struct etimer *t,
|
||||
uint16_t value);
|
||||
bool timer_elapsed_seconds_short(
|
||||
struct etimer *t,
|
||||
uint16_t value);
|
||||
bool timer_elapsed_minutes_short(
|
||||
struct etimer *t,
|
||||
uint16_t value);
|
||||
|
||||
/* interval timer */
|
||||
void timer_interval_start(
|
||||
struct itimer *t,
|
||||
uint32_t interval);
|
||||
void timer_interval_start_seconds(
|
||||
struct itimer *t,
|
||||
uint32_t interval);
|
||||
void timer_interval_start_minutes(
|
||||
struct itimer *t,
|
||||
uint32_t interval);
|
||||
bool timer_interval_expired(
|
||||
struct itimer *t);
|
||||
uint32_t timer_interval(
|
||||
struct itimer *t);
|
||||
uint32_t timer_interval_elapsed(
|
||||
struct itimer *t);
|
||||
void timer_interval_no_expire(
|
||||
struct itimer *t);
|
||||
void timer_interval_reset(
|
||||
struct itimer *t);
|
||||
void timer_interval_restart(
|
||||
struct itimer *t);
|
||||
|
||||
/* special for 8-bit microcontrollers - limited to 255ms */
|
||||
uint8_t timer_milliseconds_delta(
|
||||
uint8_t start);
|
||||
uint8_t timer_milliseconds_mark(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
Reference in New Issue
Block a user