#ifndef GENERAL_HPP #define GENERAL_HPP #ifdef _MSC_VER #pragma warning(disable : 4514 4512 4710 4355) #endif typedef signed char sint8; typedef unsigned char uint8; typedef signed short sint16; typedef unsigned short uint16; typedef signed int sint32; typedef unsigned int uint32; typedef signed long long sint64; typedef unsigned long long uint64; typedef signed int sint; // 32 bit - even on 64 bit machines typedef unsigned int uint; // 32 bit - even on 64 bit machines #define memzero(ptr) memset(ptr, 0, sizeof(*(ptr))) #define ArrayZero(ptr, elements) memset(ptr, 0, sizeof(*(ptr)) * (elements)) #include #include #include #include #include /* open */ #include #include #include #include #include /* printf fprintf */ #include #include #include #include /* lseek, close */ #include /* command line parser */ #include "rapidjson/document.h" #include "rapidjson/filereadstream.h" #include "rapidjson/istreamwrapper.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/writer.h" #define MAX_ACC_CARDS 4 #define VERBOSE false #define MTS_IO_CONTROLS_STATUS_LED false #define MTS_IO_CONTROLS_LS_LED false #define FIRMWARE_VERSION "Version" #define FIRMWARE_DATE "Date" #define FIRMWARE_RELEASE "Release" #define SYSFS_PLATFORM "/sys/devices/platform/mts-io/" #define HW_VERSION_PATH "/sys/devices/platform/mts-io/hw-version" #define LEDS_GPIO_DIR "/sys/devices/platform/leds-gpio/leds/" #define FIRMWARE_FILE "/etc/issue" #define CRESET "/creset" #define LORA_1_5_MTCAP_SPI "/dev/spidev0.0" #define LORA_1_5_MTCAP_SPI_FPGA "/dev/spidev0.1" #define LORA_1_5_MTCDT_SPI_AP_1 "/dev/spidev0.2" #define LORA_1_5_MTCDT_SPI_AP_2 "/dev/spidev1.2" #define LORA_2_1_FPGA_VERSION \ "mts-fpga-loader -g | grep version | awk '{printf $4}'" #define LORA_2_1_EXT_FPGA_VERSION \ "mts-fpga-loader -b 1 -g | grep version | awk '{printf $4}'" #define DEVICE_INFO_FILE "/var/run/config/device_info.json" #define RESET_SHORT_CMD "reset_short_handler" #define RESET_LONG_CMD "reset_long_handler" #define KILL_SIGNAL "kill -l " #define STORED_DIGITAL_OUTPUTS_STATE_FILE "/var/config/pin_states.json" #define KEY_EXTIO "extIo" #define KEY_DOUTPUTS "dOutputs" #define KEY_DINPUTS "dInputs" enum HardwareType { HARDWARE_MTCDT, HARDWARE_MTCDT3, HARDWARE_MTCAP, HARDWARE_INVALID }; #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #endif