diff --git a/Projects/LRF_Server/Debug/server.conf b/Projects/LRF_Server/Debug/server.conf index cabb54c6..c5d44864 100644 --- a/Projects/LRF_Server/Debug/server.conf +++ b/Projects/LRF_Server/Debug/server.conf @@ -36,6 +36,7 @@ KERNEL : { ENABLE_SAFE_SHORE = false; ENABLE_DEFENDER = false; + ENABLE_INFOSTRESS = true; DETECTOR_WIDTH = 1000; ENABLED_LRF = 255; DETECTOR_SST = 0; @@ -49,46 +50,49 @@ KERNEL : }; DEFENDER_CONNECTION : { - CURL_POST_CONTENT_TYPE = "application/json"; - SCANNER_NAME = "LRF_3D_001"; - SCANNER_DIMENTIONS = 3; - CEP_IP_ADDRESS = "192.168.200.103"; - CEP_IP_PORT = 80; + }; + INFOSTRESS_CONNECTION : + { LOCATION_LON = 35.0938962; LOCATION_LAT = 32.904208; USE_SSL = false; - ACCESS_URL = "/defender-eps/rest/simple-event/notify"; + SCANNER_NAME = "LRF_3D_001"; + SCANNER_DIMENTIONS = 3; + KAFKA_BROKER_IP = "192.168.0.111"; + KAFKA_BROKER_PORT = 9092; + KAFKA_TOPIC = "st_pd_2_3d_dd_mnd"; + ENABLE_STATUS_REPORT = false; }; }; -PROTOCOL : -{ -}; -GENERAL : -{ -}; SSDP : +{ + DEVICE_TYPE = "urn:schemas-upnp-org:device:InternetGatewayDevice:1"; + SERVER_STRING = "3DLRF-M"; + DEVICE_FRIENDLY_NAME = "3D Lidar Master Device"; + DEVICE_UUID = "47035424-731b-4d83-98c5-c4310993bbb3"; + MANUFACTURER = "Dr.Frucht Systems"; + MANUFACTURER_URL = "http://www.smartsecsystems.com"; + MODEL_NAME = "3DLRF-280-M"; + DEVICE_SERIAL_NUMBER = "1.0.12"; + PRESENTATION_URL = "http://%%s/"; + ICONS : { - DEVICE_TYPE = "urn:schemas-upnp-org:device:InternetGatewayDevice:1"; - SERVER_STRING = "3DLRF-M"; - DEVICE_FRIENDLY_NAME = "3D Lidar Master Device"; - DEVICE_UUID = "47035424-731b-4d83-98c5-c4310993bbb3"; - MANUFACTURER = "Dr.Frucht Systems"; - MANUFACTURER_URL = "http://www.smartsecsystems.com"; - MODEL_NAME = "3DLRF-280-M"; - DEVICE_SERIAL_NUMBER = "1.0.12"; - PRESENTATION_URL = "http://%%s/"; - ICONS : - { - ICON_0 : - { - FORMAT = "png"; - WIDTH = 32; - HEIGHT = 32; - DEPTH = 32; - URL = "http://%%s/favicon-32x32.png"; - }; - }; - SERVICES : + ICON_0 : { + FORMAT = "png"; + WIDTH = 32; + HEIGHT = 32; + DEPTH = 32; + URL = "http://%%s/favicon-32x32.png"; }; }; + SERVICES : + { + }; +}; +GENERAL : +{ +}; +PROTOCOL : +{ +}; diff --git a/Projects/LRF_Server/LRF_Server.vpj b/Projects/LRF_Server/LRF_Server.vpj index b2693038..ca134e7e 100644 --- a/Projects/LRF_Server/LRF_Server.vpj +++ b/Projects/LRF_Server/LRF_Server.vpj @@ -14,7 +14,7 @@ Version="1" OutputFile="%bdLRF_Server" CompilerConfigName="Latest Version" - Defines='"/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT" "/DDEBUG"'> + Defines='"/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT" "/DDEBUG" "/D__EU_PROJECT__"'> + Defines='"/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT" "/D__EU_PROJECT__"'> + OtherOptions="-lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -s"/> + @@ -253,6 +254,7 @@ + @@ -296,6 +298,7 @@ + @@ -306,6 +309,7 @@ + diff --git a/Projects/LRF_Server/build b/Projects/LRF_Server/build index d8dd813c..b1985847 100755 --- a/Projects/LRF_Server/build +++ b/Projects/LRF_Server/build @@ -1,7 +1,7 @@ #! /bin/sh -#make clean -e "CFG=Debug" +make clean -e "CFG=Debug" #make -e "CFG=Debug" diff --git a/Projects/LRF_Server/makefile b/Projects/LRF_Server/makefile index 8cb36682..9a7bb492 100644 --- a/Projects/LRF_Server/makefile +++ b/Projects/LRF_Server/makefile @@ -36,12 +36,13 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ $(OUTDIR)/json_writer.o $(OUTDIR)/LRF_ClientHandler.o \ $(OUTDIR)/LRF_DefenderHandler.o $(OUTDIR)/LRF_Detector.o \ - $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_SafeShoreHandler.o $(OUTDIR)/LRF_Server.o \ - $(OUTDIR)/LRF_targetTracker.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ - $(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_KafkaHandler.o \ + $(OUTDIR)/LRF_Kernel.o $(OUTDIR)/LRF_SafeShoreHandler.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_targetTracker.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \ + $(OUTDIR)/protocolEuropeanGeneral.o $(OUTDIR)/protocolHTTP.o \ $(OUTDIR)/protocolInfoStress.o $(OUTDIR)/protocolLGS.o \ $(OUTDIR)/protocolRGoose.o $(OUTDIR)/protocolSafeShore.o \ $(OUTDIR)/protocolTGZ.o $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o \ @@ -62,12 +63,13 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ $(OUTDIR)/json_writer.o $(OUTDIR)/LRF_ClientHandler.o \ $(OUTDIR)/LRF_DefenderHandler.o $(OUTDIR)/LRF_Detector.o \ - $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_SafeShoreHandler.o $(OUTDIR)/LRF_Server.o \ - $(OUTDIR)/LRF_targetTracker.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ - $(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_KafkaHandler.o \ + $(OUTDIR)/LRF_Kernel.o $(OUTDIR)/LRF_SafeShoreHandler.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_targetTracker.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \ + $(OUTDIR)/protocolEuropeanGeneral.o $(OUTDIR)/protocolHTTP.o \ $(OUTDIR)/protocolInfoStress.o $(OUTDIR)/protocolLGS.o \ $(OUTDIR)/protocolRGoose.o $(OUTDIR)/protocolSafeShore.o \ $(OUTDIR)/protocolTGZ.o $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o \ @@ -75,7 +77,7 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ $(OUTDIR)/xmlParser.o -COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DDEBUG" -O0 -g3 -ggdb -w -Wpointer-arith -std=c++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DDEBUG" "-D__EU_PROJECT__" -O0 -g3 -ggdb -w -Wpointer-arith -std=c++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< LINK=g++ -O0 -g3 -ggdb -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -o "$(OUTFILE)" $(ALL_OBJ) # Pattern rules @@ -212,12 +214,13 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ $(OUTDIR)/json_writer.o $(OUTDIR)/LRF_ClientHandler.o \ $(OUTDIR)/LRF_DefenderHandler.o $(OUTDIR)/LRF_Detector.o \ - $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_SafeShoreHandler.o $(OUTDIR)/LRF_Server.o \ - $(OUTDIR)/LRF_targetTracker.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ - $(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_KafkaHandler.o \ + $(OUTDIR)/LRF_Kernel.o $(OUTDIR)/LRF_SafeShoreHandler.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_targetTracker.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \ + $(OUTDIR)/protocolEuropeanGeneral.o $(OUTDIR)/protocolHTTP.o \ $(OUTDIR)/protocolInfoStress.o $(OUTDIR)/protocolLGS.o \ $(OUTDIR)/protocolRGoose.o $(OUTDIR)/protocolSafeShore.o \ $(OUTDIR)/protocolTGZ.o $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o \ @@ -238,12 +241,13 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ $(OUTDIR)/json_writer.o $(OUTDIR)/LRF_ClientHandler.o \ $(OUTDIR)/LRF_DefenderHandler.o $(OUTDIR)/LRF_Detector.o \ - $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Kernel.o \ - $(OUTDIR)/LRF_SafeShoreHandler.o $(OUTDIR)/LRF_Server.o \ - $(OUTDIR)/LRF_targetTracker.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ - $(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_KafkaHandler.o \ + $(OUTDIR)/LRF_Kernel.o $(OUTDIR)/LRF_SafeShoreHandler.o \ + $(OUTDIR)/LRF_Server.o $(OUTDIR)/LRF_targetTracker.o \ + $(OUTDIR)/mask.o $(OUTDIR)/md5.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \ + $(OUTDIR)/protocolEuropeanGeneral.o $(OUTDIR)/protocolHTTP.o \ $(OUTDIR)/protocolInfoStress.o $(OUTDIR)/protocolLGS.o \ $(OUTDIR)/protocolRGoose.o $(OUTDIR)/protocolSafeShore.o \ $(OUTDIR)/protocolTGZ.o $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o \ @@ -251,8 +255,8 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ $(OUTDIR)/xmlParser.o -COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< -LINK=g++ -O3 -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl -s -o "$(OUTFILE)" $(ALL_OBJ) +COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-D__EU_PROJECT__" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -O3 -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -s -o "$(OUTFILE)" $(ALL_OBJ) # Pattern rules $(OUTDIR)/%.o : ../../lib/data/transport/%.cpp diff --git a/lib/App/3dSERVER/LRF_KafkaHandler.cpp b/lib/App/3dSERVER/LRF_KafkaHandler.cpp new file mode 100644 index 00000000..456886ba --- /dev/null +++ b/lib/App/3dSERVER/LRF_KafkaHandler.cpp @@ -0,0 +1,109 @@ +#include "LRF_KafkaHandler.h" + +#define LOG( X ) m_pLog->Log( "LRF_KafkaHandler", this, X ) +#ifdef DEBUG + #define LOG_ERROR( X ) {\ + char _tBfrErrMSG2w34[256];\ + sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ + m_pLog->Log( "LRF_KafkaHandler", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ + } +#else + #define LOG_ERROR( X ) m_pLog->Log( "LRF_KafkaHandler", this, _LOG_ERROR, X ); +#endif + + +// Constructor implementation +LRF_KafkaHandler::LRF_KafkaHandler( config_setting_t *SNode ) : basicThread(), basicEventHandler(), protocolInfoStress( SNode ){ + m_pLog = basicLogCollection::getInstance(); + if(!basicThread::init()){ + LOG_ERROR("Error Create Thread!"); + } else { + if( !protocolInfoStress::init() ) { + LOG_ERROR("Error INIT KAFKA!"); + }; + }; +}; + +// Destructor implementation +LRF_KafkaHandler::~LRF_KafkaHandler(){ + +}; + +/* Periodical Job Handler */ +void LRF_KafkaHandler::m_fThreadProc( void ){ + m_bThreadStatus = TH_WORKING; + while( m_bThreadStatus < TH_ENDED ) { + m_llTicks ++;//= getMilliseconds(); + if( m_llTicks % 20 == 0 ) { // each 2 seconds + StatusUpdate(); + //m_lCycleCounter == 0; + }; + /* No need for time Sync + if( m_llTicks % 350 == 0 ) { // each 35 seconds + StartTimeSynch(); + //m_lCycleCounter == 0; + }; + */ + SLEEP(100); + }; +}; + +void LRF_KafkaHandler::dispatchEvent( basicEvent *Evt ){ +#ifdef DEBUG + LOG( "CLIENT's DISPATCHER"); +#endif + if( Evt == NULL ) { + LOG( "Evt NULL"); + return; + }; + if( Evt->m_eClass == EVT_CLASS_SENSOR ) { +#ifdef DEBUG + char tBuffer[256]; + sprintf( tBuffer, "Event Class %d Type %d ", Evt->m_eClass , Evt->m_eType ); + LOG( tBuffer ); +#endif + switch( Evt->m_eType ) { + case EVT_TARGET_WHITE: + case EVT_TARGET_BLACK: + case EVT_TARGET: + case EVT_ALARM:{ + CLIENT_EVENT *tCEVT; + tCEVT = (CLIENT_EVENT *) Evt->m_pEvtData; + if( tCEVT != NULL ){ + float Az, El; + uint32_t cRange; + cRange = (uint32_t)(((float) tCEVT->range ) * 0.0732421875f ) ; // To meters + #ifdef PRU_SLAVE + make3Ddeg( tCEVT->th_id, Az, El, false ); + #else + make3Ddeg( tCEVT->th_id, Az, El, true ); + #endif + Alarm3D( (int)Az, (int)El, cRange , tCEVT->k_id ); + }; + }; + break; + case EVT_ERROR: + SetStatus( false ); + break; + case EVT_SCAN: + //StatusUpdate(); + //break; + case EVT_FLIP: + SetStatus( true ); + //StatusUpdate(); + break; + case EVT_COMMAND: + break; + default: + LOG_ERROR("Unknown Event!"); + }; + } else { +#ifdef DEBUG + LOG( "No SENSOR EVT "); +#endif + } +}; + + +#undef LOG +#undef LOG_ERROR diff --git a/lib/App/3dSERVER/LRF_KafkaHandler.h b/lib/App/3dSERVER/LRF_KafkaHandler.h new file mode 100644 index 00000000..5129074a --- /dev/null +++ b/lib/App/3dSERVER/LRF_KafkaHandler.h @@ -0,0 +1,29 @@ +#ifndef __LRF_KAFKA_HANDLER_H_INCL__ +#define __LRF_KAFKA_HANDLER_H_INCL__ + +#include "../../data/protocol/protocolLGS.h" +#include "../../data/net/netClientHandler.h" +#include "../../components/base/basicLogCollection.h" +#include "../../data/protocol/protocolInfoStress.h" +#include "../../data/net/clientPort.h" + +/** + * TODO: Add class description + * + * @author Gagua + */ +class LRF_KafkaHandler : public basicThread, public basicEventHandler, public protocolInfoStress { + private: + basicLogCollection * m_pLog; + EventsFIFO m_oOutputFIFO; + clientPort * m_pSocketPort; + unsigned long long m_llTicks; + protected: + virtual void m_fThreadProc( void ); + public: + explicit LRF_KafkaHandler( config_setting_t *SNode ); + virtual ~LRF_KafkaHandler(); + virtual void dispatchEvent( basicEvent *Evt ); +}; + +#endif // __LRF_CLIENTHANDLER_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_Kernel.cpp b/lib/App/3dSERVER/LRF_Kernel.cpp index 7b505c81..188d14b7 100644 --- a/lib/App/3dSERVER/LRF_Kernel.cpp +++ b/lib/App/3dSERVER/LRF_Kernel.cpp @@ -39,9 +39,12 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(){ m_nFlipSavierID = 0; m_pShadow = NULL; #ifdef __EU_PROJECT__ + m_bSafeShoreSupport = true; m_pSafeShoreHandler = NULL; - //m_pSocketPort = NULL; - //m_pSafeshoreProt = NULL; + m_bDefenderSupport = true; + m_pDefenderHandler = NULL; + m_bKafkaSupport = true; + m_pKafkaHandler = NULL; #endif m_pTracker = NULL; m_pNetClientsServer = NULL; @@ -66,6 +69,14 @@ LRF_Kernel::~LRF_Kernel(){ #ifdef DEBUG LOG("Safe Shore - Done"); #endif + if( m_pDefenderHandler ) delete( m_pDefenderHandler ); + #ifdef DEBUG + LOG("Defender - Done"); + #endif + if( m_pKafkaHandler ) delete( m_pKafkaHandler ); + #ifdef DEBUG + LOG("Kafka - Done"); + #endif #endif if( m_pShadow ) delete( m_pShadow ); @@ -91,6 +102,7 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ int tVal; char tBuffer[256]; LOG("Getting Settings ..."); + #ifdef __EU_PROJECT__ if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_SAFE_SHORE, &tVal ) ){ tVal = m_bSafeShoreSupport = true; @@ -103,7 +115,6 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ sprintf( tBuffer, "Safe-Shore support Read From Settings: %d", tVal ); LOG( tBuffer ); }; -#endif if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_DEFENDER, &tVal ) ){ tVal = m_bDefenderSupport = true; pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_DEFENDER, CONFIG_TYPE_BOOL ); @@ -115,7 +126,18 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ sprintf( tBuffer, "Defender support Read From Settings: %d", tVal ); LOG( tBuffer ); }; - + if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_KAFKA, &tVal ) ){ + tVal = m_bKafkaSupport = true; + pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_KAFKA, CONFIG_TYPE_BOOL ); + config_setting_set_bool( pSetting, tVal ); + m_pSettingsProvider->compromise(); + LOG("Kafka support not defined"); + } else { + m_bKafkaSupport = (bool)tVal; + sprintf( tBuffer, "Kafka support Read From Settings: %d", tVal ); + LOG( tBuffer ); + }; +#endif if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, &tVal )){ tVal = m_nWidth = 1000; pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, CONFIG_TYPE_INT); @@ -201,6 +223,7 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ }; m_lCycleCounter = 2; + #ifdef __EU_PROJECT__ if( m_bSafeShoreSupport ){ m_pSafeShoreHandler = new LRF_SafeShoreHandler( m_pSettings ); @@ -208,13 +231,19 @@ bool LRF_Kernel::create( LRF_HardwareManager *ptr, networkServer *srvPort ){ LOG_ERROR("SafeShore Protocol failed!"); }; }; -#endif if( m_bDefenderSupport ) { m_pDefenderHandler = new LRF_DefenderHandler( m_pSettings ); if( m_pDefenderHandler == NULL ) { LOG_ERROR("Defender Protocol failed!"); }; }; + if( m_bKafkaSupport ) { + m_pKafkaHandler = new LRF_KafkaHandler( m_pSettings ); + if( m_pKafkaHandler == NULL ) { + LOG_ERROR("Kafka Protocol failed!"); + }; + }; +#endif #ifdef DEBUG LOG( "Target Tracker about to be created" ); @@ -310,18 +339,25 @@ void LRF_Kernel::m_fThreadProc( void ){ LOG( "B-Target Will be Ignored by Build" ); #endif #endif + #ifdef __EU_PROJECT__ if( m_bSafeShoreSupport ){ if( m_pSafeShoreHandler != NULL ) { m_pSafeShoreHandler->SetStatus( true ); }; }; -#endif if( m_bDefenderSupport ) { if( m_pDefenderHandler != NULL ) { m_pDefenderHandler->SetStatus( true ); }; }; + if( m_bKafkaSupport ) { + if( m_pKafkaHandler != NULL ) { + m_pKafkaHandler->SetStatus( true ); + }; + }; +#endif + thresholdNode *ptr; ptr = m_pHardwareManager->getWorkingMemory(); if( ptr!= NULL ){ @@ -365,7 +401,7 @@ void LRF_Kernel::m_fThreadProc( void ){ if( cNode.flags.active ){ // Filter Events from Disabled Kernels -> goes to flip if( ((1 << cNode.flags.lrf ) & m_nKernelFilter ) == 0 ){ - // Abort checking this target since Kernel Disabled + // Abort checking this target since LRF Channel is Disabled continue; }; if( cNode.flags.w_cnt ){ @@ -626,6 +662,7 @@ PLGS_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ }; return tParam; }; + bool LRF_Kernel::setDetectionParameters( PLGS_PARAMETERS ptr ){ bool isCompromised = false; HW_PARAMS tHwParams; @@ -760,6 +797,7 @@ bool LRF_Kernel::shutdown( bool Restart ){ return true; }; +#ifndef PRU_SLAVE bool LRF_Kernel::stopMotors( void ){ #ifndef ONPC_TOTTAL_SIMULATOR if( m_pHardwareManager!= NULL ) { @@ -781,7 +819,7 @@ bool LRF_Kernel::startMotors( void ){ return true; #endif }; - +#endif // PRU_SLAVE /* bool LRF_Kernel::getTarget( TARGET *t ){ diff --git a/lib/App/3dSERVER/LRF_Kernel.h b/lib/App/3dSERVER/LRF_Kernel.h index 2a955901..a803a988 100644 --- a/lib/App/3dSERVER/LRF_Kernel.h +++ b/lib/App/3dSERVER/LRF_Kernel.h @@ -20,21 +20,24 @@ #include "../../components/base/basicThread.h" #include "../../components/base/basicEngine.h" #include "../../components/base/basicSettingsProvider.h" +#include "../../components/base/basicEventHeap.h" +#include "../../data/net/netServer.h" +#include "../../alg/lgs/detector.h" +#include "../../alg/lgs/mask.h" -#define __EU_PROJECT__ +#include "LRF_HardwareManager.h" +#include "LRF_targetTracker.h" #ifdef __EU_PROJECT__ - #include "LRF_SafeShoreHandler.h" + #include "LRF_SafeShoreHandler.h" + #include "LRF_DefenderHandler.h" + #include "LRF_KafkaHandler.h" + + #define KNL_SETTINGS_SAFE_SHORE "ENABLE_SAFE_SHORE" + #define KNL_SETTINGS_DEFENDER "ENABLE_DEFENDER" + #define KNL_SETTINGS_KAFKA "ENABLE_INFOSTRESS" #endif -#include "../../components/base/basicEventHeap.h" -#include "../../data/net/netServer.h" -#include "LRF_HardwareManager.h" -#include "LRF_targetTracker.h" -#include "LRF_SafeShoreHandler.h" -#include "LRF_DefenderHandler.h" -#include "../../alg/lgs/detector.h" -#include "../../alg/lgs/mask.h" //#define DUMP_TH_AFTER_FLIP_ON_DISK @@ -43,8 +46,7 @@ #define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units #define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units -#define KNL_SETTINGS_SAFE_SHORE "ENABLE_SAFE_SHORE" -#define KNL_SETTINGS_DEFENDER "ENABLE_DEFENDER" + #define KNL_SETTINGS_DETECTOR_WIDTH "DETECTOR_WIDTH" #define KNL_SETTINGS_FILTER_KERNELS "ENABLED_LRF" #define KNL_SETTINGS_DETECTOR_SST "DETECTOR_SST" @@ -60,36 +62,35 @@ class LRF_Kernel: public basicThread { private: - basicLogCollection *m_pLog; - LRF_HardwareManager *m_pHardwareManager; - basicEventHeap *m_pEventHeap; - LRF_targetTracker *m_pTracker; - config_setting_t *m_pSettings; - basicSettingsProvider *m_pSettingsProvider; - uint32_t m_nKernelFilter; - uint32_t m_lCycleCounter; - uint32_t m_nFlipCounter; - uint32_t m_nFlipSavierID; - uint8_t m_bExitCause; - LRF_WORK_MODE m_eWorkMode; + basicLogCollection * m_pLog; + LRF_HardwareManager * m_pHardwareManager; + basicEventHeap * m_pEventHeap; + LRF_targetTracker * m_pTracker; + config_setting_t * m_pSettings; + basicSettingsProvider * m_pSettingsProvider; + uint32_t m_nKernelFilter; + uint32_t m_lCycleCounter; + uint32_t m_nFlipCounter; + uint32_t m_nFlipSavierID; + uint8_t m_bExitCause; + LRF_WORK_MODE m_eWorkMode; #ifdef __EU_PROJECT__ - bool m_bSafeShoreSupport; - LRF_SafeShoreHandler *m_pSafeShoreHandler; - //clientPort *m_pSocketPort; - //protocolSafeShore *m_pSafeshoreProt; + bool m_bSafeShoreSupport; + LRF_SafeShoreHandler * m_pSafeShoreHandler; + bool m_bDefenderSupport; + LRF_DefenderHandler * m_pDefenderHandler; + bool m_bKafkaSupport; + LRF_KafkaHandler * m_pKafkaHandler; #endif - bool m_bDefenderSupport; - LRF_DefenderHandler *m_pDefenderHandler; - - networkServer *m_pNetClientsServer; - thresholdNode *m_pThreshold; - uint32_t m_nThresholdSize; + networkServer * m_pNetClientsServer; + thresholdNode * m_pThreshold; + uint32_t m_nThresholdSize; // Detection Stuff - uint32_t m_nWidth; - uint32_t m_nSST; + uint32_t m_nWidth; + uint32_t m_nSST; // Shadow - ShadowMask *m_pShadow; + ShadowMask * m_pShadow; protected: void m_fThreadProc( void ); @@ -98,33 +99,35 @@ class LRF_Kernel: public basicThread { explicit LRF_Kernel( LRF_HardwareManager *HM = NULL ); // Destructor - virtual ~LRF_Kernel(); + virtual ~LRF_Kernel(); - bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL ); - bool attachNetServer( networkServer *srvPort ); - void WaitFinish( bool Force = false ); + bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL ); + bool attachNetServer( networkServer *srvPort ); + void WaitFinish( bool Force = false ); /* functional API */ - bool askReset( void ); - LRF_WORK_MODE getMode( void ){ return m_eWorkMode; }; - bool getParameters( void ); - ShadowMask *getShadowMask( void ){ return m_pShadow; }; - thresholdNode *getTreshold( uint32_t &size, uint8_t kID=0 ); - //bool getTarget( TARGET *t ); - //uint32_t getErrorAngle( void ); - //void clearErrorAngle( void ); - //bool isErrorAngle( void ); - bool setMode( LRF_WORK_MODE nMode ); - bool setOffset( uint8_t nOffset ); - bool setOrder( uint8_t nOrder ); - - PLGS_PARAMETERS getDetectionParameters( void ); - bool setDetectionParameters( PLGS_PARAMETERS ptr ); - bool reset( bool FullRestart = false ); - bool shutdown( bool Restart = false ); - uint8_t getExitCause( void ){ return m_bExitCause; }; - bool stopMotors( void ); - bool startMotors( void ); + bool askReset( void ); + LRF_WORK_MODE getMode( void ){ return m_eWorkMode; }; + bool getParameters( void ); + ShadowMask * getShadowMask( void ){ return m_pShadow; }; + thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); + //bool getTarget( TARGET *t ); + //uint32_t getErrorAngle( void ); + //void clearErrorAngle( void ); + //bool isErrorAngle( void ); + bool setMode( LRF_WORK_MODE nMode ); + bool setOffset( uint8_t nOffset ); + bool setOrder( uint8_t nOrder ); + + PLGS_PARAMETERS getDetectionParameters( void ); + bool setDetectionParameters( PLGS_PARAMETERS ptr ); + bool reset( bool FullRestart = false ); + bool shutdown( bool Restart = false ); + uint8_t getExitCause( void ){ return m_bExitCause; }; +#ifndef PRU_SLAVE + bool stopMotors( void ); + bool startMotors( void ); +#endif }; #endif // __LRF_KERNEL_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_targetTracker.h b/lib/App/3dSERVER/LRF_targetTracker.h index 3938b6d0..27cc7cff 100644 --- a/lib/App/3dSERVER/LRF_targetTracker.h +++ b/lib/App/3dSERVER/LRF_targetTracker.h @@ -42,30 +42,30 @@ typedef struct S_TRACKING_RECORD{ * @author gagua */ class LRF_targetTracker { -private: - basicLogCollection *m_pLog; - basicEventHeap *m_pEventHeap; - uint32_t m_nSST; - bool m_bPoolOverflow; - uint32_t m_nWidth; - uint32_t m_nDelta; - uint32_t m_nSTS; - uint32_t m_nSTS_R; - TRACKING_RECORD m_aTargetsPool[TRACKER_MAX_TARGETS_POOL]; - TRACKING_RECORD *createTrackingRecord( targetRecord *TR, bool master = true ); - void clearTrackingRecord( int index ); - bool compareTrackingRecords( TRACKING_RECORD *A, TRACKING_RECORD *B ); - void extentTrackingRecord( TRACKING_RECORD *A, TRACKING_RECORD *B ); -public: - // Constructor - explicit LRF_targetTracker( int SST = 0, uint32_t Width = 0, uint32_t Delta = 32 ); + private: + basicLogCollection * m_pLog; + basicEventHeap * m_pEventHeap; + uint32_t m_nSST; + bool m_bPoolOverflow; + uint32_t m_nWidth; + uint32_t m_nDelta; + uint32_t m_nSTS; + uint32_t m_nSTS_R; + TRACKING_RECORD m_aTargetsPool[TRACKER_MAX_TARGETS_POOL]; + TRACKING_RECORD * createTrackingRecord( targetRecord *TR, bool master = true ); + void clearTrackingRecord( int index ); + bool compareTrackingRecords( TRACKING_RECORD *A, TRACKING_RECORD *B ); + void extentTrackingRecord( TRACKING_RECORD *A, TRACKING_RECORD *B ); + public: + // Constructor + explicit LRF_targetTracker( int SST = 0, uint32_t Width = 0, uint32_t Delta = 32 ); - // Destructor - virtual ~LRF_targetTracker(); - int validateTarget( targetRecord *TR, bool master = true ); - void ScanComplete( void ); - void MirrorComplete( void ); - uint32_t getSST( void ){ return m_nSST; }; + // Destructor + virtual ~LRF_targetTracker(); + int validateTarget( targetRecord *TR, bool master = true ); + void ScanComplete( void ); + void MirrorComplete( void ); + uint32_t getSST( void ){ return m_nSST; }; }; #endif // __LRF_TARGETTRACKER_H_INCL__ diff --git a/lib/data/protocol/protocolDefender.cpp b/lib/data/protocol/protocolDefender.cpp index 248e11e2..612fdaaf 100644 --- a/lib/data/protocol/protocolDefender.cpp +++ b/lib/data/protocol/protocolDefender.cpp @@ -10,133 +10,6 @@ #define LOGS( X ) basicLogCollection::getInstance()->Log( "Defender", NULL, X ) #define LOG_ERROR( X ) m_pLog->Log( "Defender", this, _LOG_ERROR, X ) -CSTR defenderStatusMode[] = { - "OPERATIONAL", - "DEGRADED" -}; -CSTR defenderFaultCode[] = { - "Critical", - "Warning", - "Info" -}; -CSTR defenderCategories[] = { - DFSL_CATEGORY_ERROR, - DFSL_CATEGORY_STATUS, - DFSL_CATEGORY_ALARM_2D, - DFSL_CATEGORY_ALARM_3D -}; -CSTR defenderTypeDescription[] = { - "Fault Event", - "Status Message", - "Target Detection Event", - "Target Detection Event" -}; -CSTR defenderTypeSeverity[] = { - "very-low", - "low", - "medium", - "high", - "very-high" -}; - -/* Global Time Diff Value to correct Timestamps */ -static int g_iTimeDiff = 0; - -/** - * number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC - */ -//#define EPOCH_DIFF 11644473600LL - -#define UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT 116444736000000000 - -#ifdef __linux__ -unsigned long long getSHDTimeValue( void ){ - unsigned long long tMilliseconds; - struct timeval tData; - struct timezone tTZ; - tMilliseconds = 0; - tTZ.tz_minuteswest = 0; - tTZ.tz_dsttime = 0; - if( gettimeofday( &tData, &tTZ ) == -1 ){ - } else { - tMilliseconds = tData.tv_sec; - tMilliseconds = tMilliseconds *1000; - tMilliseconds += tData.tv_usec / 1000; - }; -#else -/* -void TimetToFileTime( time_t t, LPFILETIME pft ){ - LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000; - pft->dwLowDateTime = (DWORD) ll; - pft->dwHighDateTime = ll >>32; -}*/ -unsigned __int64 getSHDTimeValue( void ){ - unsigned __int64 tMilliseconds; - SYSTEMTIME Ztime; - GetSystemTime(&Ztime); - SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); - tMilliseconds -= UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT; - tMilliseconds = tMilliseconds / 10000; -#endif - tMilliseconds += g_iTimeDiff; - return tMilliseconds; -}; - -CSTR getSHDTimeStamp( void ){ - CSTR RetVal = NULL; - time_t rawtime; - uint32_t msec; - struct tm * ptm = NULL; - - time ( &rawtime ); - ptm = gmtime ( &rawtime ); - msec = getSHTimeValue() % 1000; - //2019-03-24T12:32:59.670Z - if( ptm != NULL ) { - RetVal = (CSTR) malloc( 128 ); - if( RetVal!=NULL ){ - sprintf( RetVal, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", - (ptm->tm_year+1900), - (ptm->tm_mon+1), - ptm->tm_mday, - ptm->tm_hour, - ptm->tm_min, - ptm->tm_sec, - msec - ); - }; - }; - return RetVal; -}; - -bool correctSHDTime( int diff ){ -#ifdef __linux__ - struct timeval tData; - struct timezone tTZ; - tTZ.tz_minuteswest = 0; - tTZ.tz_dsttime = 0; - if( gettimeofday( &tData, &tTZ ) == -1 ){ - return false; - } else { - tData.tv_sec += diff / 1000; - tData.tv_usec += ( diff * 1000 ) % 1000000; - }; - if( settimeofday( &tData, &tTZ ) == -1 ){ - return false; - }; -#else - unsigned __int64 tMilliseconds; - SYSTEMTIME Ztime; - GetSystemTime(&Ztime); - SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); - tMilliseconds += diff * 10000; - FileTimeToSystemTime( (FILETIME*) &tMilliseconds, &Ztime ); - if( 0 == SetSystemTime(&Ztime) ) return false; -#endif - return true; -}; - - CSTR protocolDefender::buildURL( CSTR templ, int dim, CSTR devID ){ CSTR RetVal; RetVal = (CSTR) malloc( 256 ); diff --git a/lib/data/protocol/protocolDefender.h b/lib/data/protocol/protocolDefender.h index 11afd7fc..e68598a5 100644 --- a/lib/data/protocol/protocolDefender.h +++ b/lib/data/protocol/protocolDefender.h @@ -20,63 +20,7 @@ #include "xmlParser.h" -#define PROTOCOL_TYPE_3D true -#define PROTOCOL_TYPE_2D false -#define SERVICE_URL_TEMPLATE_NOTIFY "/simple-event/notify" -#define SERVICE_URL_TEMPLATE_STATUS "/sensors/lidar%dd/%s/status" -#define SERVICE_URL_TEMPLATE_FAULT "/sensors/lidar%dd/%s/fault" -#define SERVICE_URL_TEMPLATE_EVENT "/sensors/lidar%dd/%s/event" -#define SERVICE_URL_TEMPLATE_CALLBACK "/sensors/lidar%dd/%s/httpcallback" -#define SERVICE_URL_TEMPLATE_CLOCKSYNC "/sensors/lidar%dd/%s/clocksync" - -#define DFSL_HARDWARE_TYPE "SensorNode" - -#ifdef PRU_SLAVE - #define DFSL_SOURCE_NAME_ "SLAVE_SENSOR" -#else - #define DFSL_SOURCE_NAME_ "MASTER_SENSOR" -#endif - -#define DFSL_CATEGORY_ALARM_3D "dfsl#intruder-drone-detected" -#define DFSL_CATEGORY_ALARM_2D "dfsl#intruder-human-detected" -#define DFSL_CATEGORY_STATUS "dfsl#sensor-status-message" -#define DFSL_CATEGORY_ERROR "dfsl#sensor-error-message" -#define DFRL_PROVIDER_ID "DFSL" -#define DFSL_DATA_TYPE_TARGET "EventLidarTarget" -#define DFSL_DATA_TYPE_STATUS "EventLidarStatus" -#define DFSL_DATA_TYPE_ERROR "EventLidarFault" -//defender-eps.eng.it -#define DFSL_DEFENDER_DEFAULT_URL "/defender-eps/rest/simple-event/notify" - -typedef enum E_DEFENDER_CATEGORY{ - DC_ERROR = 0, - DC_STATUS = 1, - DC_ALARM = 2, - DC_ALARM_3D = 3 -} defenderCategoryTypes; - -#define DFSL_DEVICE_ "DFSL Lidar Sensor" -#define DFSL_LOCATION_DTO "{\"point\": [ %2.5f, %2.5f ] }" -#define DFSL_SENSOR_SOURCE_DTO "{ \"type\": \"%s\", \"providerId\": \"%s\", \"sensorNodeId\" : \"%s\" }" - -#define DFSL_2D_TARGET_DTO "{ \"AZ\": %d, \"Range\": %d, \"Width\": %d }" -#define DFSL_3D_TARGET_DTO "{ \"AZ\": %d, \"EL\": %d, \"Range\": %d }" -#define DFSL_STATUS_DTO "{ \"created\": \"%s\", \"name\": \"status\", \"value\": \"%s\" }" -#define DFSL_ERROR_DTO "{ \"created\": \"%s\", \"name\": \"code\", \"value\": \"%d\", \"description\": \"%s\" }" - -#define DFSL_SE_ENVELOPE "{\"category\": \"%s\",\"severity\": \"%s\"," \ - "\"ceiId\": \"ENGIE_CEI\"," \ - "\"startTime\": \"%s\",\"endTime\": \"%s\", \"location\": %s, " \ - "\"radius\": 0, \"data\": [ %s ]}" - -#define PACKAGE_SE_TARGET_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s," \ - " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"targets\": [%s] }" - -#define PACKAGE_SE_STATUS_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s, " \ - " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"measurements\": [%s] }" - -#define OS_SCANNER_NAME_SIZE 128 -#define OS_CEP_ADDRESS_SIZE 128 +#include "protocolEuropeanGeneral.h" /** * TODO: Add class description diff --git a/lib/data/protocol/protocolEuropeanGeneral.cpp b/lib/data/protocol/protocolEuropeanGeneral.cpp new file mode 100644 index 00000000..f5195083 --- /dev/null +++ b/lib/data/protocol/protocolEuropeanGeneral.cpp @@ -0,0 +1,132 @@ +#include "protocolEuropeanGeneral.h" +#include "../../alg/generic/md5.h" + +CSTR defenderStatusMode[] = { + "OPERATIONAL", + "DEGRADED" +}; + +CSTR defenderFaultCode[] = { + "Critical", + "Warning", + "Info" +}; + +CSTR defenderCategories[] = { + DFSL_CATEGORY_ERROR, + DFSL_CATEGORY_STATUS, + DFSL_CATEGORY_ALARM_2D, + DFSL_CATEGORY_ALARM_3D +}; + +CSTR defenderTypeDescription[] = { + "Fault Event", + "Status Message", + "Target Detection Event", + "Target Detection Event" +}; + +CSTR defenderTypeSeverity[] = { + "very-low", + "low", + "medium", + "high", + "very-high" +}; + +/* Global Time Diff Value to correct Timestamps */ +static int g_iTimeDiff = 0; + +/** + * number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC + */ +//#define EPOCH_DIFF 11644473600LL + +#define UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT 116444736000000000 + +#ifdef __linux__ +unsigned long long getSHDTimeValue( void ){ + unsigned long long tMilliseconds; + struct timeval tData; + struct timezone tTZ; + tMilliseconds = 0; + tTZ.tz_minuteswest = 0; + tTZ.tz_dsttime = 0; + if( gettimeofday( &tData, &tTZ ) == -1 ){ + } else { + tMilliseconds = tData.tv_sec; + tMilliseconds = tMilliseconds *1000; + tMilliseconds += tData.tv_usec / 1000; + }; +#else +/* +void TimetToFileTime( time_t t, LPFILETIME pft ){ + LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000; + pft->dwLowDateTime = (DWORD) ll; + pft->dwHighDateTime = ll >>32; +}*/ +unsigned __int64 getSHDTimeValue( void ){ + unsigned __int64 tMilliseconds; + SYSTEMTIME Ztime; + GetSystemTime(&Ztime); + SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); + tMilliseconds -= UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT; + tMilliseconds = tMilliseconds / 10000; +#endif + tMilliseconds += g_iTimeDiff; + return tMilliseconds; +}; + +CSTR getSHDTimeStamp( void ){ + CSTR RetVal = NULL; + time_t rawtime; + uint32_t msec; + struct tm * ptm = NULL; + + time ( &rawtime ); + ptm = gmtime ( &rawtime ); + msec = getSHDTimeValue() % 1000; + //2019-03-24T12:32:59.670Z + if( ptm != NULL ) { + RetVal = (CSTR) malloc( 128 ); + if( RetVal!=NULL ){ + sprintf( RetVal, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", + (ptm->tm_year+1900), + (ptm->tm_mon+1), + ptm->tm_mday, + ptm->tm_hour, + ptm->tm_min, + ptm->tm_sec, + msec + ); + }; + }; + return RetVal; +}; + +bool correctSHDTime( int diff ){ +#ifdef __linux__ + struct timeval tData; + struct timezone tTZ; + tTZ.tz_minuteswest = 0; + tTZ.tz_dsttime = 0; + if( gettimeofday( &tData, &tTZ ) == -1 ){ + return false; + } else { + tData.tv_sec += diff / 1000; + tData.tv_usec += ( diff * 1000 ) % 1000000; + }; + if( settimeofday( &tData, &tTZ ) == -1 ){ + return false; + }; +#else + unsigned __int64 tMilliseconds; + SYSTEMTIME Ztime; + GetSystemTime(&Ztime); + SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); + tMilliseconds += diff * 10000; + FileTimeToSystemTime( (FILETIME*) &tMilliseconds, &Ztime ); + if( 0 == SetSystemTime(&Ztime) ) return false; +#endif + return true; +}; \ No newline at end of file diff --git a/lib/data/protocol/protocolEuropeanGeneral.h b/lib/data/protocol/protocolEuropeanGeneral.h new file mode 100644 index 00000000..1066801e --- /dev/null +++ b/lib/data/protocol/protocolEuropeanGeneral.h @@ -0,0 +1,89 @@ +#ifndef __PROTOCOL_EUROPEAN_GENERAL__ +#define __PROTOCOL_EUROPEAN_GENERAL__ + +#include "../../components/base/basicFunctionality.h" + + +#define PROTOCOL_TYPE_3D true +#define PROTOCOL_TYPE_2D false +#define SERVICE_URL_TEMPLATE_NOTIFY "/simple-event/notify" +#define SERVICE_URL_TEMPLATE_STATUS "/sensors/lidar%dd/%s/status" +#define SERVICE_URL_TEMPLATE_FAULT "/sensors/lidar%dd/%s/fault" +#define SERVICE_URL_TEMPLATE_EVENT "/sensors/lidar%dd/%s/event" +#define SERVICE_URL_TEMPLATE_CALLBACK "/sensors/lidar%dd/%s/httpcallback" +#define SERVICE_URL_TEMPLATE_CLOCKSYNC "/sensors/lidar%dd/%s/clocksync" + +#define DFSL_HARDWARE_TYPE "SensorNode" + +#ifdef PRU_SLAVE + #define DFSL_SOURCE_NAME_ "SLAVE_SENSOR" +#else + #define DFSL_SOURCE_NAME_ "MASTER_SENSOR" +#endif + +#define DFSL_CATEGORY_ALARM_3D "dfsl#intruder-drone-detected" +#define DFSL_CATEGORY_ALARM_2D "dfsl#intruder-human-detected" +#define DFSL_CATEGORY_STATUS "dfsl#sensor-status-message" +#define DFSL_CATEGORY_ERROR "dfsl#sensor-error-message" +#define DFRL_PROVIDER_ID "DFSL" +#define DFSL_DATA_TYPE_TARGET "EventLidarTarget" +#define DFSL_DATA_TYPE_STATUS "EventLidarStatus" +#define DFSL_DATA_TYPE_ERROR "EventLidarFault" +//defender-eps.eng.it +#define DFSL_DEFENDER_DEFAULT_URL "/defender-eps/rest/simple-event/notify" +#define DFSL_INFOSTRESS_DEFAULT_KAFKA_TOPIC "DFSL_TEST" + +typedef enum E_DEFENDER_CATEGORY{ + DC_ERROR = 0, + DC_STATUS = 1, + DC_ALARM = 2, + DC_ALARM_3D = 3 +} defenderCategoryTypes; + +#define DFSL_DEVICE_ "DFSL Lidar Sensor" +#define DFSL_LOCATION_DTO "{\"point\": [ %2.5f, %2.5f ] }" +#define DFSL_SENSOR_SOURCE_DTO "{ \"type\": \"%s\", \"providerId\": \"%s\", \"sensorNodeId\" : \"%s\" }" + +#define DFSL_2D_TARGET_DTO "{ \"AZ\": %d, \"Range\": %d, \"Width\": %d }" +#define DFSL_3D_TARGET_DTO "{ \"AZ\": %d, \"EL\": %d, \"Range\": %d }" +#define DFSL_STATUS_DTO "{ \"created\": \"%s\", \"name\": \"status\", \"value\": \"%s\" }" +#define DFSL_ERROR_DTO "{ \"created\": \"%s\", \"name\": \"code\", \"value\": \"%d\", \"description\": \"%s\" }" + +#define DFSL_SE_ENVELOPE "{\"category\": \"%s\",\"severity\": \"%s\"," \ + "\"ceiId\": \"ENGIE_CEI\"," \ + "\"startTime\": \"%s\",\"endTime\": \"%s\", \"location\": %s, " \ + "\"radius\": 0, \"data\": [ %s ]}" + +#define PACKAGE_SE_TARGET_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s," \ + " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"targets\": [%s] }" + +#define PACKAGE_SE_STATUS_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s, " \ + " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"measurements\": [%s] }" + +#define PACKAGE_INFOSTRESS_DATA_2D "{\"id\": \"%s\", \"version\": \"1.0\", \"partner\": \"DFSL\"," \ + "\"device\": \"%s\", \"azimuth\": %0.3f, " \ + "\"range\": %0.3f, \"width\": %d }" +#define PACKAGE_INFOSTRESS_DATA_3D "{\"id\": \"%s\", \"version\": \"1.0\", \"partner\": \"DFSL\"," \ + "\"device\": \"%s\", \"azimuth\": %0.3f, \"elevation\": %0.3f, " \ + "\"range\": %0.3f }" + +#define OS_SCANNER_NAME_SIZE 128 +#define OS_CEP_ADDRESS_SIZE 128 + +#ifdef __linux__ + unsigned long long getSHDTimeValue( void ); +#else + unsigned __int64 getSHDTimeValue( void ); +#endif + +CSTR getSHDTimeStamp( void ); + +bool correctSHDTime( int diff ); + +extern CSTR defenderStatusMode[]; +extern CSTR defenderFaultCode[]; +extern CSTR defenderCategories[]; +extern CSTR defenderTypeDescription[]; +extern CSTR defenderTypeSeverity[]; + +#endif \ No newline at end of file diff --git a/lib/data/protocol/protocolInfoStress.cpp b/lib/data/protocol/protocolInfoStress.cpp index a947a290..c1092167 100644 --- a/lib/data/protocol/protocolInfoStress.cpp +++ b/lib/data/protocol/protocolInfoStress.cpp @@ -5,142 +5,12 @@ #include #include #include +//https://il.iherb.com/pr/KAL-Blood-Sugar-Defense-60-Tablets/70138 #define LOG( X ) m_pLog->Log( "InfoStress", this, X ) #define LOGS( X ) basicLogCollection::getInstance()->Log( "InfoStress", NULL, X ) #define LOG_ERROR( X ) m_pLog->Log( "InfoStress", this, _LOG_ERROR, X ) - -CSTR defenderStatusMode[] = { - "OPERATIONAL", - "DEGRADED" -}; - -CSTR defenderFaultCode[] = { - "Critical", - "Warning", - "Info" -}; - -CSTR defenderCategories[] = { - DFSL_CATEGORY_ERROR, - DFSL_CATEGORY_STATUS, - DFSL_CATEGORY_ALARM_2D, - DFSL_CATEGORY_ALARM_3D -}; - -CSTR defenderTypeDescription[] = { - "Fault Event", - "Status Message", - "Target Detection Event", - "Target Detection Event" -}; - -CSTR defenderTypeSeverity[] = { - "very-low", - "low", - "medium", - "high", - "very-high" -}; - -/* Global Time Diff Value to correct Timestamps */ -static int g_iTimeDiff = 0; - -/** - * number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC - */ -//#define EPOCH_DIFF 11644473600LL - -#define UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT 116444736000000000 - -#ifdef __linux__ -unsigned long long getSHDTimeValue( void ){ - unsigned long long tMilliseconds; - struct timeval tData; - struct timezone tTZ; - tMilliseconds = 0; - tTZ.tz_minuteswest = 0; - tTZ.tz_dsttime = 0; - if( gettimeofday( &tData, &tTZ ) == -1 ){ - } else { - tMilliseconds = tData.tv_sec; - tMilliseconds = tMilliseconds *1000; - tMilliseconds += tData.tv_usec / 1000; - }; -#else /* -void TimetToFileTime( time_t t, LPFILETIME pft ){ - LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000; - pft->dwLowDateTime = (DWORD) ll; - pft->dwHighDateTime = ll >>32; -}*/ -unsigned __int64 getSHDTimeValue( void ){ - unsigned __int64 tMilliseconds; - SYSTEMTIME Ztime; - GetSystemTime(&Ztime); - SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); - tMilliseconds -= UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT; - tMilliseconds = tMilliseconds / 10000; -#endif - tMilliseconds += g_iTimeDiff; - return tMilliseconds; -}; - -CSTR getSHDTimeStamp( void ){ - CSTR RetVal = NULL; - time_t rawtime; - uint32_t msec; - struct tm * ptm = NULL; - - time ( &rawtime ); - ptm = gmtime ( &rawtime ); - msec = getSHTimeValue() % 1000; - //2019-03-24T12:32:59.670Z - if( ptm != NULL ) { - RetVal = (CSTR) malloc( 128 ); - if( RetVal!=NULL ){ - sprintf( RetVal, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", - (ptm->tm_year+1900), - (ptm->tm_mon+1), - ptm->tm_mday, - ptm->tm_hour, - ptm->tm_min, - ptm->tm_sec, - msec - ); - }; - }; - return RetVal; -}; - -bool correctSHDTime( int diff ){ -#ifdef __linux__ - struct timeval tData; - struct timezone tTZ; - tTZ.tz_minuteswest = 0; - tTZ.tz_dsttime = 0; - if( gettimeofday( &tData, &tTZ ) == -1 ){ - return false; - } else { - tData.tv_sec += diff / 1000; - tData.tv_usec += ( diff * 1000 ) % 1000000; - }; - if( settimeofday( &tData, &tTZ ) == -1 ){ - return false; - }; -#else - unsigned __int64 tMilliseconds; - SYSTEMTIME Ztime; - GetSystemTime(&Ztime); - SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds ); - tMilliseconds += diff * 10000; - FileTimeToSystemTime( (FILETIME*) &tMilliseconds, &Ztime ); - if( 0 == SetSystemTime(&Ztime) ) return false; -#endif - return true; -}; - - CSTR protocolInfoStress::buildURL( CSTR templ, int dim, CSTR devID ){ CSTR RetVal; RetVal = (CSTR) malloc( 256 ); @@ -153,6 +23,7 @@ CSTR protocolInfoStress::buildURL( CSTR templ, int dim, CSTR devID ){ }; return RetVal; }; +*/ CSTR protocolInfoStress::buildUniqID( void ){ CSTR RetVal; @@ -165,12 +36,11 @@ CSTR protocolInfoStress::buildUniqID( void ){ protocolInfoStress::protocolInfoStress( config_setting_t *Settings ){ m_pLog = basicLogCollection::getInstance(); - m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "INOSTRESS_CONNECTION"); + m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "INFOSTRESS_CONNECTION"); m_pKafka = NULL; - m_pKafkaConf = NULL; - m_pKafkaBrokers = (CSTR)malloc(CLOG); - if( m_pKafkaBrokers == NULL ) return; - memset( m_pKafkaBrokers, 0 , CLOG); + m_pKafkaBrokerSTR = (CSTR)malloc(CLOG); + if( m_pKafkaBrokerSTR == NULL ) return; + memset( m_pKafkaBrokerSTR, 0 , CLOG); m_pKafkaTopicSTR= (CSTR)malloc(CLOG); if( m_pKafkaTopicSTR == NULL ) return; memset( m_pKafkaTopicSTR, 0 , CLOG); @@ -188,85 +58,83 @@ protocolInfoStress::protocolInfoStress( config_setting_t *Settings ){ m_bCurrentStatus = false; m_bMitigationStatus = false; + m_bEnabled = false; + m_bEnableStatus = false; if( m_pSettings != NULL ){ - int intVar; - double floatVar; - config_setting_t *pSetting; - if (Settings != NULL) { - m_bEnabled = true; - } else { - if (!config_setting_lookup_bool(m_pSettings, "ENABLE", &intVar)) { - intVar = m_bEnabled = false; - LOG("PROTOCOL DISABLED[default]"); - pSetting = config_setting_add(m_pSettings, "ENABLE", CONFIG_TYPE_BOOL); - config_setting_set_bool(pSetting, intVar); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_bEnabled = (bool)intVar; - }; - }; - if ( m_bEnabled ) { - if (!config_setting_lookup_float(m_pSettings, "LOCATION_LON", &floatVar)) { - m_fLon = floatVar = 35.0938962; - pSetting = config_setting_add(m_pSettings, "LOCATION_LON", CONFIG_TYPE_FLOAT); - config_setting_set_float(pSetting, floatVar); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_fLon = floatVar; - }; - if (!config_setting_lookup_float(m_pSettings, "LOCATION_LAT", &floatVar)) { - m_fLat = floatVar = 32.904208; - pSetting = config_setting_add(m_pSettings, "LOCATION_LAT", CONFIG_TYPE_FLOAT); - config_setting_set_float(pSetting, floatVar); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_fLat = floatVar; - }; - if (!config_setting_lookup_bool(m_pSettings, "USE_SSL", &intVar)) { - intVar = m_bUseSSL = false; - LOG("PROTOCOL DISABLED[default]"); - pSetting = config_setting_add(m_pSettings, "USE_SSL", CONFIG_TYPE_BOOL); - config_setting_set_bool(pSetting, intVar); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_bUseSSL = (bool)intVar; - }; - if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)) { - strncpy(m_pScannerName, "LRF_2D_001", 64); - LOG(m_pScannerName); - pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING); - config_setting_set_string(pSetting, m_pScannerName); - basicSettingsProvider::getInstance()->compromise(); - }; - if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions)) { - m_nScannerDimentions = 2; - pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT); - config_setting_set_int(pSetting, m_nScannerDimentions); - basicSettingsProvider::getInstance()->compromise(); - }; - if (!config_setting_lookup_string(m_pSettings, "CEP_IP_ADDRESS", (const char**)&m_pServerIP)) { - strncpy(m_pServerIP, "192.168.200.204", 16); - LOG(m_pServerIP); - pSetting = config_setting_add(m_pSettings, "CEP_IP_ADDRESS", CONFIG_TYPE_STRING); - config_setting_set_string(pSetting, m_pServerIP); - basicSettingsProvider::getInstance()->compromise(); - }; - LOG(m_pServerIP); - if (!config_setting_lookup_int(m_pSettings, "CEP_IP_PORT", &m_nServerPort)) { - m_nServerPort = 80; - pSetting = config_setting_add(m_pSettings, "CEP_IP_PORT", CONFIG_TYPE_INT); - config_setting_set_int(pSetting, m_nServerPort); - basicSettingsProvider::getInstance()->compromise(); - }; - if (!config_setting_lookup_string(m_pSettings, "ACCESS_URL", (const char**)&m_pAccessURL)) { - strncpy( m_pAccessURL, DFSL_DEFENDER_DEFAULT_URL, CTEXT ); - pSetting = config_setting_add(m_pSettings, "ACCESS_URL", CONFIG_TYPE_STRING); - config_setting_set_string(pSetting, m_pAccessURL); - basicSettingsProvider::getInstance()->compromise(); - }; - LOG(m_pAccessURL); - }; + int intVar; + double floatVar; + config_setting_t *pSetting; + if (!config_setting_lookup_float(m_pSettings, "LOCATION_LON", &floatVar)) { + m_fLon = floatVar = 35.0938962; + pSetting = config_setting_add(m_pSettings, "LOCATION_LON", CONFIG_TYPE_FLOAT); + config_setting_set_float(pSetting, floatVar); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_fLon = floatVar; + }; + if (!config_setting_lookup_float(m_pSettings, "LOCATION_LAT", &floatVar)) { + m_fLat = floatVar = 32.904208; + pSetting = config_setting_add(m_pSettings, "LOCATION_LAT", CONFIG_TYPE_FLOAT); + config_setting_set_float(pSetting, floatVar); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_fLat = floatVar; + }; + if (!config_setting_lookup_bool(m_pSettings, "USE_SSL", &intVar)) { + intVar = m_bUseSSL = false; + LOG("SSL DISABLED[default]"); + pSetting = config_setting_add(m_pSettings, "USE_SSL", CONFIG_TYPE_BOOL); + config_setting_set_bool(pSetting, intVar); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_bUseSSL = (bool)intVar; + }; + if (!config_setting_lookup_bool(m_pSettings, "ENABLE_STATUS_REPORT", &intVar)) { + intVar = m_bEnableStatus = false; + LOG("Status Report DISABLED[default]"); + pSetting = config_setting_add(m_pSettings, "ENABLE_STATUS_REPORT", CONFIG_TYPE_BOOL); + config_setting_set_bool(pSetting, intVar); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_bEnableStatus = (bool)intVar; + }; + if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)) { + strncpy(m_pScannerName, "LRF_2D_001", 64); + LOG(m_pScannerName); + pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING); + config_setting_set_string(pSetting, m_pScannerName); + basicSettingsProvider::getInstance()->compromise(); + }; + if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions)) { + m_nScannerDimentions = 2; + pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT); + config_setting_set_int(pSetting, m_nScannerDimentions); + basicSettingsProvider::getInstance()->compromise(); + }; + if (!config_setting_lookup_string(m_pSettings, "KAFKA_BROKER_IP", (const char**)&m_pServerIP)) { + strncpy(m_pServerIP, "192.168.200.204", 16); + LOG(m_pServerIP); + pSetting = config_setting_add(m_pSettings, "KAFKA_BROKER_IP", CONFIG_TYPE_STRING); + config_setting_set_string(pSetting, m_pServerIP); + basicSettingsProvider::getInstance()->compromise(); + }; + LOG(m_pServerIP); + if (!config_setting_lookup_int(m_pSettings, "KAFKA_BROKER_PORT", &m_nServerPort)) { + m_nServerPort = 80; + pSetting = config_setting_add(m_pSettings, "KAFKA_BROKER_PORT", CONFIG_TYPE_INT); + config_setting_set_int(pSetting, m_nServerPort); + basicSettingsProvider::getInstance()->compromise(); + }; + sprintf( m_pKafkaBrokerSTR, "%s:%d", m_pServerIP, m_nServerPort ); + LOG( m_pKafkaBrokerSTR ); + if (!config_setting_lookup_string(m_pSettings, "KAFKA_TOPIC", (const char**)&m_pKafkaTopicSTR)) { + strncpy( m_pKafkaTopicSTR, DFSL_INFOSTRESS_DEFAULT_KAFKA_TOPIC, CTEXT ); + pSetting = config_setting_add(m_pSettings, "KAFKA_TOPIC", CONFIG_TYPE_STRING); + config_setting_set_string(pSetting, m_pKafkaTopicSTR); + basicSettingsProvider::getInstance()->compromise(); + }; + LOG( m_pKafkaTopicSTR ); basicSettingsProvider::getInstance()->validate(); }; @@ -299,24 +167,21 @@ static void dr_msg_cb( rd_kafka_t *rk, const rd_kafka_message_t *rkmessage, void */ protocolInfoStress::~protocolInfoStress(){ - if(m_pKafka!=NULL){ + m_bEnabled = false; + if( m_pKafka != NULL ){ /* Wait for final messages to be delivered or fail. * rd_kafka_flush() is an abstraction over rd_kafka_poll() which * waits for all messages to be delivered. */ LOG("Flushing final messages.."); - //rd_kafka_flush( m_pKafka, 3000 ); - m_pKafka->flush(3*1000 /* wait for max 3 seconds */); + m_pKafka->flush( 3000 /* wait for max 3 seconds */); /* If the output queue is still not empty there is an issue * with producing messages to the clusters. */ - //if( rd_kafka_outq_len( m_pKafka ) > 0 ) LOG_ERROR("Some messages are not delivered!"); if (m_pKafka->outq_len() > 0) LOG_ERROR("Some messages are not delivered!"); - //rd_kafka_destroy(m_pKafka); delete m_pKafka; }; - //if(m_pKafkaConf!=NULL)rd_kafka_destroy(m_pKafkaConf); - if(m_pScannerName!=NULL)free(m_pScannerName); - if(m_pServerIP!=NULL)free(m_pServerIP); - if( m_pAccessURL != NULL)free(m_pAccessURL); + if( m_pScannerName != NULL ) free(m_pScannerName); + if( m_pServerIP != NULL ) free(m_pServerIP); + if( m_pAccessURL != NULL ) free(m_pAccessURL); }; //https://github.com/edenhill/librdkafka/blob/master/examples/producer.c //https://github.com/edenhill/librdkafka/blob/master/examples/producer.cpp @@ -339,40 +204,78 @@ void protocolInfoStress::dr_cb( RdKafka::Message &message ){ }; bool protocolInfoStress::init(){ - //char tBuffer[CLOG]; - std::string tBuffer; - std::string brokers = m_pKafkaBrokers; - std::string topic = m_pKafkaTopicSTR; + RdKafka::Conf * tProducerConf; + RdKafka::Conf * tTopicConf; + + std::string tBuffer; + std::string brokers = m_pKafkaBrokerSTR; + std::string topic = m_pKafkaTopicSTR; - if( strlen( m_pKafkaBrokers ) == 0 ) { + LOG("Begin Init"); + if( strlen( m_pKafkaBrokerSTR ) == 0 ) { LOG_ERROR("No Kafka Brokers are defined!"); return false; }; - //m_pKafkaConf = rd_kafka_conf_new(); - m_pKafkaConf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL); - if( m_pKafkaConf == NULL ) { - LOG_ERROR("Eror Creating Kafka Conf!"); + tProducerConf = RdKafka::Conf::create( RdKafka::Conf::CONF_GLOBAL ); + if( tProducerConf == NULL ) { + LOG_ERROR("Eror Creating Producer Conf!"); return false; }; - if( m_pKafkaConf->set("bootstrap.servers", m_pKafkaBrokers, tBuffer ) != RdKafka::Conf::CONF_OK ){ + LOG("RdKafka::Conf::CONF_GLOBAL Created"); + tTopicConf = RdKafka::Conf::create(RdKafka::Conf::CONF_TOPIC); + if( tTopicConf==NULL ){ + LOG_ERROR("Eror Creating Topic Conf!"); + delete( tProducerConf ); + tProducerConf = NULL; + return false; + }; + LOG("RdKafka::Conf::CONF_TOPIC Created"); + + if( tProducerConf->set("bootstrap.servers", brokers, tBuffer ) != RdKafka::Conf::CONF_OK ){ LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; return false; }; - //if( rd_kafka_conf_set( m_pKafkaConf, "bootstrap.servers", m_pKafkaBrokers, tBuffer, CLOG ) != RD_KAFKA_CONF_OK ){ - // LOG_ERROR( tBuffer ); - // return false; - //}; + LOG("bootstrap.servers is SET"); + + if( tProducerConf->set("metadata.broker.list", brokers, tBuffer ) != RdKafka::Conf::CONF_OK ){ + LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; + return false; + }; + LOG("metadata.broker.list is SET"); /* Set the delivery report callback. * This callback will be called once per message to inform * the application if delivery succeeded or failed. * See dr_msg_cb() above. * The callback is only triggered from rd_kafka_poll() and * rd_kafka_flush(). */ - //rd_kafka_conf_set_dr_msg_cb( m_pKafkaConf, dr_msg_cb ); - if( m_pKafkaConf->set( "dr_cb", this, tBuffer ) != RdKafka::Conf::CONF_OK ){ + //tProducerConf->set("queue.buffering.max.ms", "100", tBuffer ); + //tProducerConf->set("socket.blocking.max.ms", "100", tBuffer ); + if( tProducerConf->set( "dr_cb", this, tBuffer ) != RdKafka::Conf::CONF_OK ){ + LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; + return false; + }; + LOG("dr_cb is SET"); + if( tProducerConf->set("default_topic_conf", tTopicConf, tBuffer ) != RdKafka::Conf::CONF_OK ){ LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; return false; }; + LOG("default_topic_conf is SET"); /* * Create producer instance. * @@ -380,24 +283,36 @@ bool protocolInfoStress::init(){ * and the application must not reference it again after * this call. */ - //m_pKafka = rd_kafka_new( RD_KAFKA_PRODUCER, m_pKafkaConf, tBuffer, CLOG ); - m_pKafka = RdKafka::Producer::create( m_pKafkaConf, tBuffer ); + m_pKafka = RdKafka::Producer::create( tProducerConf, tBuffer ); if( m_pKafka == NULL ){ LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; return false; }; - m_pKafkaTopic = RdKafka::Topic::create( m_pKafka, topic, m_pKafkaConf, tBuffer ); + LOG("RdKafka::Producer Created"); + m_pKafkaTopic = RdKafka::Topic::create( m_pKafka, topic, tTopicConf, tBuffer ); if( m_pKafkaTopic == NULL ) { LOG_ERROR( tBuffer.c_str() ); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; return false; }; - //?? - delete( m_pKafkaConf ); - m_pKafkaConf = NULL; + LOG("RdKafka::Topic Created"); + delete( tProducerConf ); + delete( tTopicConf ); + tProducerConf = NULL; + tTopicConf = NULL; + LOG("INIT Complete"); + m_bEnabled = true; return true; }; -bool protocolInfoStress::issuePost( CSTR URL, CSTR Buffer, int BufferSize ){ +bool protocolInfoStress::issuePost( CSTR Buffer, int BufferSize ){ if( m_pKafka == NULL) return false; RdKafka::ErrorCode err; retry: @@ -412,7 +327,9 @@ retry: ); if( err != RdKafka::ERR_NO_ERROR ) { ///std::cerr << "% Failed to produce to topic " << topic << ": " << RdKafka::err2str(err) << std::endl; + LOG_ERROR("Failed to produce to topic"); if( err == RdKafka::ERR__QUEUE_FULL ){ + LOG("Internal queue is full!"); /* If the internal queue is full, wait for * messages to be delivered and then retry. * The internal queue represents both @@ -429,7 +346,7 @@ retry: } #ifdef DEBUG else { - LOG("MSG OK"); + LOG("MSG Queued OK"); //std::cerr << "% Enqueued message (" << line.size() << " bytes) " << "for topic " << topic << std::endl; } #endif @@ -445,7 +362,13 @@ retry: * to make sure previously produced messages have their * delivery report callback served (and any other callbacks * you register). */ - m_pKafka->poll(0); + m_pKafka->poll(100); + //uint8_t cnt = 100; + //while ( cnt && m_pKafka->outq_len() > 0) { + // LOG("Wait ..."); + // cnt--; + // m_pKafka->poll(100); + //}; return true; }; @@ -569,73 +492,43 @@ CSTR protocolInfoStress::assembleFaultData( uint8_t Code, CSTR Desc ){ }; return RetVal; }; -CSTR protocolInfoStress::assembleTargetData( int targetID, int Range, int Width, int Azimuth, int Elevation ){ - CSTR RetVal; - CSTR TIME_STAMP; - CSTR tSRC; - CSTR tTARGET; - CSTR tID; +CSTR protocolInfoStress::assembleTargetData( bool is3D, int targetID, int Range, int Width, int Azimuth, int Elevation ){ + CSTR RetVal = NULL; RetVal = (CSTR) malloc(CLOG); if ( RetVal != NULL ) { - TIME_STAMP = getSHDTimeStamp(); - if( TIME_STAMP != NULL ) { - tTARGET = (CSTR) malloc(128); - if( tTARGET!= NULL) { - tSRC = (CSTR) malloc(128); - if( tSRC ) { - tID = (CSTR) malloc(64); - if( tID != NULL ) { - sprintf( tID, "%s", MD5String( TIME_STAMP ) ); - sprintf( tSRC, DFSL_SENSOR_SOURCE_DTO, DFSL_HARDWARE_TYPE, DFRL_PROVIDER_ID, m_pScannerName ); - if( m_nScannerDimentions > 2 ) { - sprintf( tTARGET, DFSL_3D_TARGET_DTO, Azimuth, Elevation, Range ); - } else { - sprintf( tTARGET, DFSL_2D_TARGET_DTO, Azimuth, Range, Width ); - }; - sprintf( RetVal, - PACKAGE_SE_TARGET_DATA_ELEMENT, - defenderTypeDescription[DC_ALARM], - TIME_STAMP, - tSRC, - "DFSL_TARGET_DATA", - DFSL_DATA_TYPE_TARGET, - tID, - tTARGET - ); - free( tID ); - free( tSRC ); - free( tTARGET ); - free( TIME_STAMP ); - } else { - free( tSRC ); - free( tTARGET ); - free( TIME_STAMP ); - free( RetVal ); - } - } else { - free( tTARGET ); - free( TIME_STAMP ); - free( RetVal ); - }; - } else { - free( TIME_STAMP ); - free( RetVal ); - }; - } else { - free( RetVal ); - RetVal = NULL; - }; + CSTR TIME_STAMP = NULL; + TIME_STAMP = getTStr(); + if( TIME_STAMP!= NULL ) { + char tID[64]; + float Az; + float Ra; + sprintf( tID, "%s", MD5String( TIME_STAMP ) ); + free( TIME_STAMP ); + Ra = Range; + Az = Azimuth; + if( is3D ) { + float El; + El = Elevation; + sprintf( RetVal, PACKAGE_INFOSTRESS_DATA_3D, tID, m_pScannerName, Az, El, Ra ); + } else { + sprintf( RetVal, PACKAGE_INFOSTRESS_DATA_2D, tID, m_pScannerName, Az, Ra, Width ); + }; + } else { + free( RetVal ); + RetVal = NULL; + }; }; return RetVal; }; -static uint32_t DEFENDER_MESSAGE_ID = 0; + +static uint32_t INFOSTRESS_MESSAGE_ID = 0; size_t protocolInfoStress::assembleDefenderJSON( CSTR Buffer, defenderCategoryTypes Type, uint8_t Severity, CSTR Location, CSTR Data ){ char tBuffer[CLOG]; size_t RetVal; CSTR tBuf; RetVal = 0; tBuf = getSHDTimeStamp(); - DEFENDER_MESSAGE_ID++; + INFOSTRESS_MESSAGE_ID++; //memset( tBuffer, 0, CLOG ); if( tBuf != NULL ){ //char ID[64]; @@ -711,11 +604,14 @@ bool protocolInfoStress::buildFaultPackage( unsigned char *Buffer, int &BufferSi bool protocolInfoStress::buildEvent2DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, float Angle, float Range, float Width){ if( Buffer!= NULL ){ CSTR tBuf; - tBuf = assembleTargetData( targetID, Range, Width, Angle, 0 ); + tBuf = assembleTargetData( false, targetID, Range, Width, Angle, 0 ); if( tBuf != NULL ){ - char DFSL_LOCATION[256]; - sprintf(DFSL_LOCATION, DFSL_LOCATION_DTO, m_fLon, m_fLat ); - BufferSize = assembleDefenderJSON( (CSTR)Buffer, DC_ALARM, 3, DFSL_LOCATION, tBuf ); + BufferSize = strlen( tBuf ); + strncpy( (char *)Buffer, tBuf, BufferSize ); + Buffer[BufferSize] = (char) 0; +#ifdef DEBUG + LOG((CSTR)Buffer); +#endif free( tBuf ); return true; }; @@ -726,14 +622,11 @@ bool protocolInfoStress::buildEvent2DPackage( unsigned char *Buffer, int &Buffer bool protocolInfoStress::buildEvent3DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, float Angle1, float Angle2, float Range ){ if( Buffer!= NULL ){ CSTR tBuf; - tBuf = assembleTargetData( targetID, Range, 0, Angle1, Angle2 ); -#ifdef DEBUG - //LOG(tBuf); -#endif + tBuf = assembleTargetData( true, targetID, Range, 0, Angle1, Angle2 ); if( tBuf != NULL ){ - char DFSL_LOCATION[256]; - sprintf(DFSL_LOCATION, DFSL_LOCATION_DTO, m_fLon, m_fLat ); - BufferSize = assembleDefenderJSON( (CSTR)Buffer, DC_ALARM, 3, DFSL_LOCATION, tBuf ); + BufferSize = strlen( tBuf ); + strncpy( (char *)Buffer, tBuf, BufferSize ); + Buffer[BufferSize] = (char) 0; #ifdef DEBUG LOG((CSTR)Buffer); #endif @@ -780,20 +673,12 @@ bool protocolInfoStress::Alarm2D( float Angle, float Range, float Width, int ID bool RetVal= false; char Buffer[1024]; int BufferSize = 0; - CSTR URL; CSTR UID; if(!m_bEnabled) return false; UID = buildUniqID(); if( UID!= NULL ){ - URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName ); -#ifdef DEBUG - LOG(URL); -#endif RetVal = buildEvent2DPackage( ( unsigned char *) Buffer, BufferSize, UID, ID, Angle, Range, Width ); - if( URL != NULL ){ - RetVal = issuePost( URL, Buffer, BufferSize ); - free( URL ); - }; + RetVal = issuePost( Buffer, BufferSize ); free( UID ); }; return RetVal; @@ -803,80 +688,52 @@ bool protocolInfoStress::Alarm3D( float Angle1, float Angle2, float Range, int I bool RetVal= false; char Buffer[1024]; int BufferSize = 0; - CSTR URL; CSTR UID; if(!m_bEnabled) return false; UID = buildUniqID(); if( UID!= NULL ){ - URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName ); -#ifdef DEBUG - LOG(URL); -#endif RetVal = buildEvent3DPackage( ( unsigned char *) Buffer, BufferSize, UID, ID, Angle1, Angle2, Range ); - if( URL != NULL ){ - RetVal = issuePost( URL, Buffer, BufferSize ); - free( URL ); - }; + RetVal = issuePost( Buffer, BufferSize ); free( UID ); }; return RetVal; }; bool protocolInfoStress::VisibilityChanged( bool Worsened ){ + if( !m_bEnableStatus ) return true; bool RetVal= false; char Buffer[1024]; int BufferSize = 0; - CSTR URL; if(!m_bEnabled) return false; - URL = buildURL( SERVICE_URL_TEMPLATE_STATUS, m_nScannerDimentions, m_pScannerName ); -#ifdef DEBUG - LOG(URL); -#endif RetVal = buildStatusPackage( ( unsigned char *) Buffer, BufferSize, !Worsened ); - if( URL != NULL ){ - RetVal = issuePost( URL, Buffer, BufferSize ); - free( URL ); - }; + RetVal = issuePost( Buffer, BufferSize ); return RetVal; }; bool protocolInfoStress::StatusUpdate( void ){ + if( !m_bEnableStatus ) return true; bool RetVal= false; char Buffer[1024]; int BufferSize = 0; - CSTR URL; if(!m_bEnabled) return false; - URL = buildURL( SERVICE_URL_TEMPLATE_STATUS, m_nScannerDimentions, m_pScannerName ); -#ifdef DEBUG - LOG(URL); -#endif RetVal = buildStatusPackage( ( unsigned char *) Buffer, BufferSize, m_bCurrentStatus ); - if( URL != NULL ){ - RetVal = issuePost( URL, Buffer, BufferSize ); - free( URL ); - }; + RetVal = issuePost( Buffer, BufferSize ); return RetVal; }; bool protocolInfoStress::ErrorReporting( int lvl, CSTR Descr ){ + if( !m_bEnableStatus ) return true; bool RetVal= false; char Buffer[1024]; int BufferSize = 0; - CSTR URL; if(!m_bEnabled) return false; - URL = buildURL( SERVICE_URL_TEMPLATE_FAULT, m_nScannerDimentions, m_pScannerName ); -#ifdef DEBUG - LOG(URL); -#endif RetVal = buildFaultPackage( ( unsigned char *) Buffer, BufferSize, lvl, Descr ); - if( URL != NULL ){ - RetVal = issuePost( URL, Buffer, BufferSize ); - free( URL ); - }; + RetVal = issuePost( Buffer, BufferSize ); return RetVal; }; bool protocolInfoStress::StartTimeSynch( void ){ + if( !m_bEnableStatus ) return true; bool RetVal= false; //LOG("TimeSYnc"); /*char Buffer[1024]; diff --git a/lib/data/protocol/protocolInfoStress.h b/lib/data/protocol/protocolInfoStress.h index 8ee2f61d..dee7d9b0 100644 --- a/lib/data/protocol/protocolInfoStress.h +++ b/lib/data/protocol/protocolInfoStress.h @@ -14,70 +14,11 @@ //#include #include - -#include "../../components/base/basicFunctionality.h" +#include "protocolEuropeanGeneral.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicSettingsProvider.h" -#define PROTOCOL_TYPE_3D true -#define PROTOCOL_TYPE_2D false -#define SERVICE_URL_TEMPLATE_NOTIFY "/simple-event/notify" -#define SERVICE_URL_TEMPLATE_STATUS "/sensors/lidar%dd/%s/status" -#define SERVICE_URL_TEMPLATE_FAULT "/sensors/lidar%dd/%s/fault" -#define SERVICE_URL_TEMPLATE_EVENT "/sensors/lidar%dd/%s/event" -#define SERVICE_URL_TEMPLATE_CALLBACK "/sensors/lidar%dd/%s/httpcallback" -#define SERVICE_URL_TEMPLATE_CLOCKSYNC "/sensors/lidar%dd/%s/clocksync" - -#define DFSL_HARDWARE_TYPE "SensorNode" - -#ifdef PRU_SLAVE - #define DFSL_SOURCE_NAME_ "SLAVE_SENSOR" -#else - #define DFSL_SOURCE_NAME_ "MASTER_SENSOR" -#endif - -#define DFSL_CATEGORY_ALARM_3D "dfsl#intruder-drone-detected" -#define DFSL_CATEGORY_ALARM_2D "dfsl#intruder-human-detected" -#define DFSL_CATEGORY_STATUS "dfsl#sensor-status-message" -#define DFSL_CATEGORY_ERROR "dfsl#sensor-error-message" -#define DFRL_PROVIDER_ID "DFSL" -#define DFSL_DATA_TYPE_TARGET "EventLidarTarget" -#define DFSL_DATA_TYPE_STATUS "EventLidarStatus" -#define DFSL_DATA_TYPE_ERROR "EventLidarFault" -//defender-eps.eng.it -#define DFSL_DEFENDER_DEFAULT_URL "/defender-eps/rest/simple-event/notify" - -typedef enum E_DEFENDER_CATEGORY{ - DC_ERROR = 0, - DC_STATUS = 1, - DC_ALARM = 2, - DC_ALARM_3D = 3 -} defenderCategoryTypes; - -#define DFSL_DEVICE_ "DFSL Lidar Sensor" -#define DFSL_LOCATION_DTO "{\"point\": [ %2.5f, %2.5f ] }" -#define DFSL_SENSOR_SOURCE_DTO "{ \"type\": \"%s\", \"providerId\": \"%s\", \"sensorNodeId\" : \"%s\" }" - -#define DFSL_2D_TARGET_DTO "{ \"AZ\": %d, \"Range\": %d, \"Width\": %d }" -#define DFSL_3D_TARGET_DTO "{ \"AZ\": %d, \"EL\": %d, \"Range\": %d }" -#define DFSL_STATUS_DTO "{ \"created\": \"%s\", \"name\": \"status\", \"value\": \"%s\" }" -#define DFSL_ERROR_DTO "{ \"created\": \"%s\", \"name\": \"code\", \"value\": \"%d\", \"description\": \"%s\" }" - -#define DFSL_SE_ENVELOPE "{\"category\": \"%s\",\"severity\": \"%s\"," \ - "\"ceiId\": \"ENGIE_CEI\"," \ - "\"startTime\": \"%s\",\"endTime\": \"%s\", \"location\": %s, " \ - "\"radius\": 0, \"data\": [ %s ]}" - -#define PACKAGE_SE_TARGET_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s," \ - " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"targets\": [%s] }" - -#define PACKAGE_SE_STATUS_DATA_ELEMENT "{\"description\": \"%s\", \"created\": \"%s\", \"source\": %s, " \ - " \"name\": \"%s\", \"type\": \"%s\", \"lidarSensorEventId\": \"%s\", \"measurements\": [%s] }" - -#define OS_SCANNER_NAME_SIZE 128 -#define OS_CEP_ADDRESS_SIZE 128 - /** * TODO: Add class description * @@ -90,10 +31,12 @@ private: //rd_kafka_t * m_pKafka; /* Producer instance handle */ RdKafka::Producer * m_pKafka; /* Producer instance handle */ //rd_kafka_conf_t * m_pKafkaConf; /* Temporary configuration object */ - RdKafka::Conf * m_pKafkaConf; /* Temporary configuration object */ - CSTR m_pKafkaBrokers; + //RdKafka::Conf * m_pKafkaConf; /* Temporary configuration object */ + CSTR m_pKafkaBrokerSTR; CSTR m_pKafkaTopicSTR; RdKafka::Topic * m_pKafkaTopic; + bool m_bUseCompression; + bool m_bEnableStatus; //uint8_t m_bKafkaBrokersCount; int m_nScannerDimentions; @@ -107,7 +50,7 @@ private: float m_fLat; int m_nServerPort; bool m_bCurrentStatus; - CSTR buildURL( CSTR templ, int dim, CSTR devID ); + //CSTR buildURL( CSTR templ, int dim, CSTR devID ); CSTR buildUniqID( void ); bool buildClockSyncPackage( unsigned char *Buffer, int &BufferSize ); bool buildCallBackPackage( unsigned char *Buffer, int &BufferSize, CSTR CallBackPath ); @@ -118,9 +61,9 @@ private: CSTR assembleStatusData( bool StatusOK ); CSTR assembleFaultData( uint8_t Code, CSTR Desc ); - CSTR assembleTargetData( int targetID, int Range, int Width, int Azimuth, int Elevation = 0 ); + CSTR assembleTargetData( bool is3D, int targetID, int Range, int Width, int Azimuth, int Elevation = 0 ); size_t assembleDefenderJSON( CSTR Buffer, defenderCategoryTypes Type, uint8_t Severity, CSTR Location, CSTR Data ); - bool issuePost( CSTR URL, CSTR Buffer, int BufferSize ); + bool issuePost( CSTR Buffer, int BufferSize ); public: // Constructor explicit protocolInfoStress( config_setting_t *Settings = NULL ); diff --git a/lib/hardware/soc/general/3DLRF.h b/lib/hardware/soc/general/3DLRF.h index 9a5bba58..0e6c9670 100644 --- a/lib/hardware/soc/general/3DLRF.h +++ b/lib/hardware/soc/general/3DLRF.h @@ -39,7 +39,10 @@ typedef enum E_LRF_WORK_MODE{ #define NO_BLACK_TARGETS //#define SHIFT_50 683 #define TGD -///#define PRU_SLAVE Defined by Makefile of Slave!! + +/* Defined by Makefile of Slave!! */ + +//#define PRU_SLAVE #ifdef ONPC_TOTTAL_SIMULATOR #define SIMULATE_TARGETS @@ -303,6 +306,8 @@ typedef struct S_targetRecord{ uint32_t width; uint32_t begin_id; uint32_t end_id; + uint16_t range_min; + uint16_t range_max; union{ uint32_t status; struct { diff --git a/lib/pru/core11/.ccsproject b/lib/pru/core11/.ccsproject new file mode 100644 index 00000000..429c6d0d --- /dev/null +++ b/lib/pru/core11/.ccsproject @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/lib/pru/core11/.cproject b/lib/pru/core11/.cproject new file mode 100644 index 00000000..a63de428 --- /dev/null +++ b/lib/pru/core11/.cproject @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/pru/core11/.project b/lib/pru/core11/.project new file mode 100644 index 00000000..c060c829 --- /dev/null +++ b/lib/pru/core11/.project @@ -0,0 +1,44 @@ + + + PRUSS1_PRU1 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + pru_adc.c + 1 + PARENT-2-PROJECT_LOC/source/lib/hardware/soc/modules/pru/pru_adc.c + + + pru_adc.h + 1 + PARENT-2-PROJECT_LOC/source/lib/hardware/soc/modules/pru/pru_adc.h + + + tupus_ext.c + 1 + PARENT-2-PROJECT_LOC/source/lib/hardware/soc/modules/pru/tupus_ext.c + + + diff --git a/lib/pru/core11/.settings/org.eclipse.cdt.codan.core.prefs b/lib/pru/core11/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 00000000..98b63502 --- /dev/null +++ b/lib/pru/core11/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/lib/pru/core11/.settings/org.eclipse.cdt.debug.core.prefs b/lib/pru/core11/.settings/org.eclipse.cdt.debug.core.prefs new file mode 100644 index 00000000..58d4fb29 --- /dev/null +++ b/lib/pru/core11/.settings/org.eclipse.cdt.debug.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker diff --git a/lib/pru/core11/.settings/org.eclipse.core.resources.prefs b/lib/pru/core11/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..c2506087 --- /dev/null +++ b/lib/pru/core11/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +encoding//Debug/makefile=UTF-8 +encoding//Debug/objects.mk=UTF-8 +encoding//Debug/sources.mk=UTF-8 +encoding//Debug/subdir_rules.mk=UTF-8 +encoding//Debug/subdir_vars.mk=UTF-8 +encoding//Release/makefile=UTF-8 +encoding//Release/objects.mk=UTF-8 +encoding//Release/sources.mk=UTF-8 +encoding//Release/subdir_rules.mk=UTF-8 +encoding//Release/subdir_vars.mk=UTF-8 diff --git a/lib/pru/core11/Debug/ccsObjs.opt b/lib/pru/core11/Debug/ccsObjs.opt new file mode 100644 index 00000000..7a224458 --- /dev/null +++ b/lib/pru/core11/Debug/ccsObjs.opt @@ -0,0 +1 @@ +"./main_core11.obj" "./main_full_core11.obj" "./pru_adc.obj" "./tupus_ext.obj" "../AM437x_PRU_SS1.cmd" "../CORE11.cmd" -llibc.a \ No newline at end of file diff --git a/lib/pru/core11/Debug/main_core11.d b/lib/pru/core11/Debug/main_core11.d new file mode 100644 index 00000000..4db19d47 --- /dev/null +++ b/lib/pru/core11/Debug/main_core11.d @@ -0,0 +1,41 @@ +# FIXED + +main_core11.obj: ../main_core11.c +main_core11.obj: C:/ti/ti-cgt-pru/include/stdint.h +main_core11.obj: C:/ti/ti-cgt-pru/include/stdio.h +main_core11.obj: C:/ti/ti-cgt-pru/include/linkage.h +main_core11.obj: C:/ti/ti-cgt-pru/include/stdarg.h +main_core11.obj: C:/ti/pru/include/am437x/pru_cfg.h +main_core11.obj: C:/ti/pru/include/am437x/pru_ctrl.h +main_core11.obj: ../../../hardware/soc/general/3DLRF.h +main_core11.obj: ../../../hardware/soc/modules/pru/tupus_ext.h +main_core11.obj: ../../../hardware/soc/modules/pru/pru_adc.h +main_core11.obj: C:/ti/pru/include/am437x/pru_iep.h +main_core11.obj: C:/ti/pru/include/am437x/pru_intc.h +main_core11.obj: C:/ti/pru/include/am437x/sys_adc0TscSs.h +main_core11.obj: C:/ti/pru/include/am437x/sys_adc1MagSs.h +main_core11.obj: ../resource_table_1.h +main_core11.obj: C:/ti/ti-cgt-pru/include/stddef.h +main_core11.obj: C:/ti/pru/include/rsc_types.h +main_core11.obj: C:/ti/pru/include/pru_types.h +main_core11.obj: C:/ti/pru/include/pru_virtio_ids.h + +../main_core11.c: +C:/ti/ti-cgt-pru/include/stdint.h: +C:/ti/ti-cgt-pru/include/stdio.h: +C:/ti/ti-cgt-pru/include/linkage.h: +C:/ti/ti-cgt-pru/include/stdarg.h: +C:/ti/pru/include/am437x/pru_cfg.h: +C:/ti/pru/include/am437x/pru_ctrl.h: +../../../hardware/soc/general/3DLRF.h: +../../../hardware/soc/modules/pru/tupus_ext.h: +../../../hardware/soc/modules/pru/pru_adc.h: +C:/ti/pru/include/am437x/pru_iep.h: +C:/ti/pru/include/am437x/pru_intc.h: +C:/ti/pru/include/am437x/sys_adc0TscSs.h: +C:/ti/pru/include/am437x/sys_adc1MagSs.h: +../resource_table_1.h: +C:/ti/ti-cgt-pru/include/stddef.h: +C:/ti/pru/include/rsc_types.h: +C:/ti/pru/include/pru_types.h: +C:/ti/pru/include/pru_virtio_ids.h: diff --git a/lib/pru/core11/Debug/main_core11.obj b/lib/pru/core11/Debug/main_core11.obj new file mode 100644 index 00000000..24552a88 Binary files /dev/null and b/lib/pru/core11/Debug/main_core11.obj differ diff --git a/lib/pru/core11/Debug/main_full_core11.d b/lib/pru/core11/Debug/main_full_core11.d new file mode 100644 index 00000000..e906e411 --- /dev/null +++ b/lib/pru/core11/Debug/main_full_core11.d @@ -0,0 +1,41 @@ +# FIXED + +main_full_core11.obj: ../main_full_core11.c +main_full_core11.obj: C:/ti/ti-cgt-pru/include/stdint.h +main_full_core11.obj: C:/ti/ti-cgt-pru/include/stdio.h +main_full_core11.obj: C:/ti/ti-cgt-pru/include/linkage.h +main_full_core11.obj: C:/ti/ti-cgt-pru/include/stdarg.h +main_full_core11.obj: C:/ti/pru/include/am437x/pru_cfg.h +main_full_core11.obj: C:/ti/pru/include/am437x/pru_ctrl.h +main_full_core11.obj: ../../../hardware/soc/general/3DLRF.h +main_full_core11.obj: ../../../hardware/soc/modules/pru/tupus_ext.h +main_full_core11.obj: ../../../hardware/soc/modules/pru/pru_adc.h +main_full_core11.obj: C:/ti/pru/include/am437x/pru_iep.h +main_full_core11.obj: C:/ti/pru/include/am437x/pru_intc.h +main_full_core11.obj: C:/ti/pru/include/am437x/sys_adc0TscSs.h +main_full_core11.obj: C:/ti/pru/include/am437x/sys_adc1MagSs.h +main_full_core11.obj: ../resource_table_1.h +main_full_core11.obj: C:/ti/ti-cgt-pru/include/stddef.h +main_full_core11.obj: C:/ti/pru/include/rsc_types.h +main_full_core11.obj: C:/ti/pru/include/pru_types.h +main_full_core11.obj: C:/ti/pru/include/pru_virtio_ids.h + +../main_full_core11.c: +C:/ti/ti-cgt-pru/include/stdint.h: +C:/ti/ti-cgt-pru/include/stdio.h: +C:/ti/ti-cgt-pru/include/linkage.h: +C:/ti/ti-cgt-pru/include/stdarg.h: +C:/ti/pru/include/am437x/pru_cfg.h: +C:/ti/pru/include/am437x/pru_ctrl.h: +../../../hardware/soc/general/3DLRF.h: +../../../hardware/soc/modules/pru/tupus_ext.h: +../../../hardware/soc/modules/pru/pru_adc.h: +C:/ti/pru/include/am437x/pru_iep.h: +C:/ti/pru/include/am437x/pru_intc.h: +C:/ti/pru/include/am437x/sys_adc0TscSs.h: +C:/ti/pru/include/am437x/sys_adc1MagSs.h: +../resource_table_1.h: +C:/ti/ti-cgt-pru/include/stddef.h: +C:/ti/pru/include/rsc_types.h: +C:/ti/pru/include/pru_types.h: +C:/ti/pru/include/pru_virtio_ids.h: diff --git a/lib/pru/core11/Debug/main_full_core11.obj b/lib/pru/core11/Debug/main_full_core11.obj new file mode 100644 index 00000000..be08e73c Binary files /dev/null and b/lib/pru/core11/Debug/main_full_core11.obj differ diff --git a/lib/pru/core11/Debug/makefile b/lib/pru/core11/Debug/makefile new file mode 100644 index 00000000..c9b5d27b --- /dev/null +++ b/lib/pru/core11/Debug/makefile @@ -0,0 +1,168 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL = cmd.exe + +CG_TOOL_ROOT := C:/ti/ti-cgt-pru + +GEN_OPTS__FLAG := +GEN_CMDS__FLAG := + +ORDERED_OBJS += \ +"./main_core11.obj" \ +"./main_full_core11.obj" \ +"./pru_adc.obj" \ +"./tupus_ext.obj" \ +"../AM437x_PRU_SS1.cmd" \ +"../CORE11.cmd" \ +$(GEN_CMDS__FLAG) \ +-llibc.a \ + +-include ../makefile.init + +RM := DEL /F +RMDIR := RMDIR /S/Q + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir_vars.mk +-include subdir_rules.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(S_DEPS)),) +-include $(S_DEPS) +endif +ifneq ($(strip $(S_UPPER_DEPS)),) +-include $(S_UPPER_DEPS) +endif +ifneq ($(strip $(S62_DEPS)),) +-include $(S62_DEPS) +endif +ifneq ($(strip $(C64_DEPS)),) +-include $(C64_DEPS) +endif +ifneq ($(strip $(ASM_DEPS)),) +-include $(ASM_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(SV7A_DEPS)),) +-include $(SV7A_DEPS) +endif +ifneq ($(strip $(S55_DEPS)),) +-include $(S55_DEPS) +endif +ifneq ($(strip $(C67_DEPS)),) +-include $(C67_DEPS) +endif +ifneq ($(strip $(CLA_DEPS)),) +-include $(CLA_DEPS) +endif +ifneq ($(strip $(C??_DEPS)),) +-include $(C??_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(S??_DEPS)),) +-include $(S??_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(C62_DEPS)),) +-include $(C62_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(ASM_UPPER_DEPS)),) +-include $(ASM_UPPER_DEPS) +endif +ifneq ($(strip $(K_DEPS)),) +-include $(K_DEPS) +endif +ifneq ($(strip $(C43_DEPS)),) +-include $(C43_DEPS) +endif +ifneq ($(strip $(INO_DEPS)),) +-include $(INO_DEPS) +endif +ifneq ($(strip $(S67_DEPS)),) +-include $(S67_DEPS) +endif +ifneq ($(strip $(SA_DEPS)),) +-include $(SA_DEPS) +endif +ifneq ($(strip $(S43_DEPS)),) +-include $(S43_DEPS) +endif +ifneq ($(strip $(OPT_DEPS)),) +-include $(OPT_DEPS) +endif +ifneq ($(strip $(PDE_DEPS)),) +-include $(PDE_DEPS) +endif +ifneq ($(strip $(S64_DEPS)),) +-include $(S64_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +ifneq ($(strip $(C55_DEPS)),) +-include $(C55_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables +EXE_OUTPUTS += \ +PRUSS1_PRU1.out \ + +EXE_OUTPUTS__QUOTED += \ +"PRUSS1_PRU1.out" \ + +BIN_OUTPUTS += \ +PRUSS1_PRU1.hex \ + +BIN_OUTPUTS__QUOTED += \ +"PRUSS1_PRU1.hex" \ + + +# All Target +all: PRUSS1_PRU1.out + +# Tool invocations +PRUSS1_PRU1.out: $(OBJS) $(CMD_SRCS) $(GEN_CMDS) + @echo 'Building target: $@' + @echo 'Invoking: PRU Linker' + "C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=near --endian=little -z -m"PRUSS1_PRU1.map" --heap_size=0x100 --stack_size=0x100 -i"C:/ti/ti-cgt-pru/lib" -i"C:/ti/ti-cgt-pru/include" --reread_libs --define=ICSS1_PRU_CORE=1 --warn_sections --diag_wrap=off --display_error_number --xml_link_info="PRUSS1_PRU1_linkInfo.xml" --rom_model -o "PRUSS1_PRU1.out" $(ORDERED_OBJS) + @echo 'Finished building target: $@' + @echo ' ' + +PRUSS1_PRU1.hex: $(EXE_OUTPUTS) + @echo 'Invoking: PRU Hex Utility' + "C:/ti/ti-cgt-pru/bin/hexpru" -o "PRUSS1_PRU1.hex" $(EXE_OUTPUTS__QUOTED) + @echo 'Finished building: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(EXE_OUTPUTS__QUOTED)$(BIN_OUTPUTS__QUOTED) + -$(RM) "main_core11.d" "main_full_core11.d" "pru_adc.d" "tupus_ext.d" + -$(RM) "main_core11.obj" "main_full_core11.obj" "pru_adc.obj" "tupus_ext.obj" + -@echo 'Finished clean' + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets + diff --git a/lib/pru/core11/Debug/objects.mk b/lib/pru/core11/Debug/objects.mk new file mode 100644 index 00000000..9ca4b124 --- /dev/null +++ b/lib/pru/core11/Debug/objects.mk @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -llibc.a + diff --git a/lib/pru/core11/Debug/sources.mk b/lib/pru/core11/Debug/sources.mk new file mode 100644 index 00000000..49ec9b1d --- /dev/null +++ b/lib/pru/core11/Debug/sources.mk @@ -0,0 +1,115 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +K_SRCS := +LD_SRCS := +S67_SRCS := +LDS_SRCS := +CMD_SRCS := +EXE_SRCS := +CXX_SRCS := +CMD_UPPER_SRCS := +ELF_SRCS := +C43_SRCS := +S55_SRCS := +LD_UPPER_SRCS := +C62_SRCS := +S_UPPER_SRCS := +A_SRCS := +SA_SRCS := +C55_SRCS := +LDS_UPPER_SRCS := +C_UPPER_SRCS := +OUT_SRCS := +INO_SRCS := +OBJ_SRCS := +S62_SRCS := +LIB_SRCS := +PDE_SRCS := +SV7A_SRCS := +ASM_SRCS := +ASM_UPPER_SRCS := +C++_SRCS := +CLA_SRCS := +S??_SRCS := +C_SRCS := +C67_SRCS := +S_SRCS := +S43_SRCS := +OPT_SRCS := +C64_SRCS := +CC_SRCS := +C??_SRCS := +S64_SRCS := +OBJS := +BIN_OUTPUTS := +S_DEPS := +S_UPPER_DEPS := +S62_DEPS := +C64_DEPS := +ASM_DEPS := +CC_DEPS := +SV7A_DEPS := +S55_DEPS := +C67_DEPS := +CLA_DEPS := +C??_DEPS := +CPP_DEPS := +S??_DEPS := +C_DEPS := +C62_DEPS := +EXE_OUTPUTS := +CXX_DEPS := +C++_DEPS := +ASM_UPPER_DEPS := +K_DEPS := +C43_DEPS := +INO_DEPS := +S67_DEPS := +SA_DEPS := +S43_DEPS := +OPT_DEPS := +PDE_DEPS := +S64_DEPS := +C_UPPER_DEPS := +C55_DEPS := +CPP_DEPS__QUOTED := +C67_DEPS__QUOTED := +INO_DEPS__QUOTED := +C??_DEPS__QUOTED := +S_UPPER_DEPS__QUOTED := +CLA_DEPS__QUOTED := +ASM_UPPER_DEPS__QUOTED := +C62_DEPS__QUOTED := +CXX_DEPS__QUOTED := +EXE_OUTPUTS__QUOTED := +S67_DEPS__QUOTED := +BIN_OUTPUTS__QUOTED := +C_DEPS__QUOTED := +C_UPPER_DEPS__QUOTED := +OPT_DEPS__QUOTED := +S_DEPS__QUOTED := +K_DEPS__QUOTED := +S??_DEPS__QUOTED := +C64_DEPS__QUOTED := +C++_DEPS__QUOTED := +OBJS__QUOTED := +CC_DEPS__QUOTED := +S43_DEPS__QUOTED := +S55_DEPS__QUOTED := +SA_DEPS__QUOTED := +C55_DEPS__QUOTED := +PDE_DEPS__QUOTED := +C43_DEPS__QUOTED := +S62_DEPS__QUOTED := +ASM_DEPS__QUOTED := +SV7A_DEPS__QUOTED := +S64_DEPS__QUOTED := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +. \ + diff --git a/lib/pru/core11/Debug/subdir_rules.mk b/lib/pru/core11/Debug/subdir_rules.mk new file mode 100644 index 00000000..a20d7360 --- /dev/null +++ b/lib/pru/core11/Debug/subdir_rules.mk @@ -0,0 +1,34 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Each subdirectory must supply rules for building sources it contributes +main_core11.obj: ../main_core11.c $(GEN_OPTS) | $(GEN_HDRS) + @echo 'Building file: $<' + @echo 'Invoking: PRU Compiler' + "C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/pru/include" --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=near --endian=little --preproc_with_compile --preproc_dependency="main_core11.d" $(GEN_OPTS__FLAG) "$<" + @echo 'Finished building: $<' + @echo ' ' + +main_full_core11.obj: ../main_full_core11.c $(GEN_OPTS) | $(GEN_HDRS) + @echo 'Building file: $<' + @echo 'Invoking: PRU Compiler' + "C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/pru/include" --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=near --endian=little --preproc_with_compile --preproc_dependency="main_full_core11.d" $(GEN_OPTS__FLAG) "$<" + @echo 'Finished building: $<' + @echo ' ' + +pru_adc.obj: D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/pru_adc.c $(GEN_OPTS) | $(GEN_HDRS) + @echo 'Building file: $<' + @echo 'Invoking: PRU Compiler' + "C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/pru/include" --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=near --endian=little --preproc_with_compile --preproc_dependency="pru_adc.d" $(GEN_OPTS__FLAG) "$<" + @echo 'Finished building: $<' + @echo ' ' + +tupus_ext.obj: D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/tupus_ext.c $(GEN_OPTS) | $(GEN_HDRS) + @echo 'Building file: $<' + @echo 'Invoking: PRU Compiler' + "C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/pru/include" --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=near --endian=little --preproc_with_compile --preproc_dependency="tupus_ext.d" $(GEN_OPTS__FLAG) "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/lib/pru/core11/Debug/subdir_vars.mk b/lib/pru/core11/Debug/subdir_vars.mk new file mode 100644 index 00000000..0b6f6e21 --- /dev/null +++ b/lib/pru/core11/Debug/subdir_vars.mk @@ -0,0 +1,46 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CMD_SRCS += \ +../AM437x_PRU_SS1.cmd \ +../CORE11.cmd + +C_SRCS += \ +../main_core11.c \ +../main_full_core11.c \ +D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/pru_adc.c \ +D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/tupus_ext.c + +OBJS += \ +./main_core11.obj \ +./main_full_core11.obj \ +./pru_adc.obj \ +./tupus_ext.obj + +C_DEPS += \ +./main_core11.d \ +./main_full_core11.d \ +./pru_adc.d \ +./tupus_ext.d + +C_DEPS__QUOTED += \ +"main_core11.d" \ +"main_full_core11.d" \ +"pru_adc.d" \ +"tupus_ext.d" + +OBJS__QUOTED += \ +"main_core11.obj" \ +"main_full_core11.obj" \ +"pru_adc.obj" \ +"tupus_ext.obj" + +C_SRCS__QUOTED += \ +"../main_core11.c" \ +"../main_full_core11.c" \ +"D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/pru_adc.c" \ +"D:/FruchtSystems/lib/source/lib/hardware/soc/modules/pru/tupus_ext.c" + + diff --git a/lib/pru/core11/main_core11.c b/lib/pru/core11/main_core11.c index 5280a805..2dcf6a01 100644 --- a/lib/pru/core11/main_core11.c +++ b/lib/pru/core11/main_core11.c @@ -104,7 +104,7 @@ volatile register uint32_t __R31; #define DEFAULT_FLIP_COUNT 9 -#define SYNC_MASK 0x8000 //(1<<16) +#define SYNC_MASK 0x8000 //(1<<16) #define STANDY_INIT_BIT (1 << 4) @@ -117,6 +117,8 @@ near uint8_t bTargetFlag[8] = {0}; near uint16_t bTargetWidthCNT[8] = {0}; near uint32_t dTargetWidth[8] = {0}; near uint32_t dTargetStart[8] = {0}; +near uint16_t dTargetMin[8] = {0}; +near uint16_t dTargetMax[8] = {0}; near uint32_t dTargetEnd[8] = {0}; near uint32_t dTargetLastRange[8] = {0}; near uint8_t m_nGPointsFlags = 0xFF; @@ -137,7 +139,7 @@ near thresholdNode m_sCurrentThresholdNode = {0}; #define WMODE_DETECTION_ENABLED 3 #ifdef TH_PER_MIRROR - #define WORKING_TH_MASK 0x20 +# define WORKING_TH_MASK 0x20 volatile thresholdNode *th_node[40] = { // First Threshold @@ -187,8 +189,8 @@ near thresholdNode m_sCurrentThresholdNode = {0}; (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 39 ) ) }; #else - #define WORKING_TH_MASK 0x08 - #ifdef TH_FULL_PER_LRF +# define WORKING_TH_MASK 0x08 +# ifdef TH_FULL_PER_LRF volatile thresholdNode *th_node[16] = { // First Threshold @@ -210,26 +212,26 @@ near thresholdNode m_sCurrentThresholdNode = {0}; (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 14 ) ), (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 15 ) ) }; - #else +# else volatile thresholdNode *th_node[2] = { (volatile thresholdNode *)TH_BASE, (volatile thresholdNode *)( TH_BASE + TH_SIZE_BYTES ) }; - #endif +# endif #endif// TH_PER_MIRROR volatile targetRecord *target_node = (volatile targetRecord *)TARGET_BASE; -#define ACTIVE_TH(A) ( m_vActiveThresholdFlags & ( 1u << ( m_bCurrentMirror[A] << 3 + A ))) -#define FLIP_ID(A) ( m_bCurrentMirror[A] << 3 + A ) -#define FLIP_TH(A) m_vActiveThresholdFlags &= ~( m_vActiveThresholdFlags & ( 1u << ( m_bCurrentMirror[A] << 3 + A ))) -#define WHITE_TARGET(A,B,C,D) addTarget( TARGET_WHITE, A, B, C, D ) -#define BLACK_TARGET(A,B,C,D) addTarget( TARGET_BLACK, A, B, C, D ) -#define FLIP(A,B) addTarget( FLIP_COMPLETE, A, B, 0, 0, 0 ) -#define ERROR(A,B) addTarget( ERROR_ANGLE, A, B, 0, 0, 0 ) -#define SCAN(A,B) addTarget( SCAN_COMPLETE, A, B, 0, 0, 0 ) -#define SCAN_FZ(A,B) addTarget( SCAN_FROZEN, A, B, 0, 0, 0 ) -#define MIRROR(A) addTarget( MIRROR_FINISHED, A, 0, 0, 0, 0 ) +#define ACTIVE_TH(A) ( m_vActiveThresholdFlags & ( 1u << ( m_bCurrentMirror[A] << 3 + A ))) +#define FLIP_ID(A) ( m_bCurrentMirror[A] << 3 + A ) +#define FLIP_TH(A) m_vActiveThresholdFlags &= ~( m_vActiveThresholdFlags & ( 1u << ( m_bCurrentMirror[A] << 3 + A ))) +#define WHITE_TARGET(A,B,C,D,E,F,J) addTarget( TARGET_WHITE, A, B, C, D, E, F, J ) +#define BLACK_TARGET(A,B,C,D,E,F,J) addTarget( TARGET_BLACK, A, B, C, D, E, F, J ) +#define FLIP(A,B) addTarget( FLIP_COMPLETE, A, B, 0, 0, 0, 0, 0 ) +#define ERROR(A,B) addTarget( ERROR_ANGLE, A, B, 0, 0, 0, 0, 0 ) +#define SCAN(A,B) addTarget( SCAN_COMPLETE, A, B, 0, 0, 0, 0, 0 ) +#define SCAN_FZ(A,B) addTarget( SCAN_FROZEN, A, B, 0, 0, 0, 0, 0 ) +#define MIRROR(A) addTarget( MIRROR_FINISHED, A, 0, 0, 0, 0, 0, 0 ) inline void clearTargets( void ){ near uint8_t index; @@ -238,11 +240,13 @@ inline void clearTargets( void ){ target_node[index].begin_id = 0; target_node[index].end_id = 0; target_node[index].status = 0; + target_node[index].range_min = 0; + target_node[index].range_max = 0; }; }; -inline void addTarget( uint8_t type, uint32_t sid, uint32_t eid, uint32_t width, uint16_t count, uint8_t kernel ){ +inline void addTarget( uint8_t type, uint32_t sid, uint32_t eid, uint32_t width, uint16_t count, uint8_t kernel, uint16_t Min, uint16_t Max ){ near uint16_t index; /*near targetRecord tVal; tVal.width = width; @@ -257,6 +261,8 @@ inline void addTarget( uint8_t type, uint32_t sid, uint32_t eid, uint32_t width, target_node[index].width = width; target_node[index].begin_id = sid; target_node[index].end_id = eid; + target_node[index].range_min = Min; + target_node[index].range_max = Max; target_node[index].status = 0x00000001 | ( ( count & 0x1FF ) << 24 ) | ( (type & 0x7F ) << 16 ) | ( kernel << 8 ); //target_node[index] = tVal; }; @@ -323,7 +329,7 @@ inline void resetMode( void ){ th_node[38][index].data = m_sCurrentThresholdNode.data; th_node[39][index].data = m_sCurrentThresholdNode.data; #else - #ifdef TH_FULL_PER_LRF +# ifdef TH_FULL_PER_LRF th_node[2][index].data = m_sCurrentThresholdNode.data; th_node[3][index].data = m_sCurrentThresholdNode.data; th_node[4][index].data = m_sCurrentThresholdNode.data; @@ -338,7 +344,7 @@ inline void resetMode( void ){ th_node[13][index].data = m_sCurrentThresholdNode.data; th_node[14][index].data = m_sCurrentThresholdNode.data; th_node[15][index].data = m_sCurrentThresholdNode.data; - #endif +# endif #endif }; @@ -454,7 +460,7 @@ void main(void) { near uint16_t m_nMirrorID = 0; #endif near uint8_t bMirrorStarted = 0; -#ifdef PRU_SLAVE +#ifdef PRU_SLAVE near uint32_t mShiftOld = Q_SCAN_COUNT; #else near uint32_t mShiftOld = 0; @@ -462,7 +468,7 @@ void main(void) { near uint8_t index = 0; near uint8_t zBuf = 0; near uint8_t bZero = 0; -#ifdef CHECK_SUN_BIT +#ifdef CHECK_SUN_BIT near uint8_t bSunBit = 0; #endif near uint8_t m_bScanCompromised = 0; @@ -508,18 +514,18 @@ void main(void) { DR_TUPUS.PRU_address = 0x12345678; DR_TUPUS.PRU_data = 0; DR_TUPUS.PRU_status = TU_STATUS_NONE; -#ifdef PRU_SLAVE - #ifdef ENCODER_8192 +#ifdef PRU_SLAVE +# ifdef ENCODER_8192 DR_TUPUS.CORE_id = 0xC0518192; - #else +# else DR_TUPUS.CORE_id = 0xC0517200; - #endif -#else - #ifdef ENCODER_8192 +# endif +#else +# ifdef ENCODER_8192 DR_TUPUS.CORE_id = 0xC0A58192; - #else +# else DR_TUPUS.CORE_id = 0xC0A57200; - #endif +# endif #endif // Detect Build Date if( date[5] > 32 ){ @@ -589,9 +595,9 @@ soft_reset: DR_TUPUS.HOST_data &= 0xFFFFFF00; #ifdef PRU_SLAVE mShiftOld = Q_SCAN_COUNT; -#else +#else mShiftOld = 0; -#endif +#endif }; if( SYS_IOS.flags.mode == WMODE_STARTUP ){ if( bZero ){ @@ -607,16 +613,16 @@ soft_reset: cShift = DR_TUPUS2.HOST_address; // Mirrors #ifdef TH_PER_MIRROR - mShift = DR_TUPUS2.PRU_address & 0x0FFF; - m_nMirrorID = ( DR_TUPUS2.PRU_address & 0xF000 ) >> 8; // not 12 to create mask + mShift = DR_TUPUS2.PRU_address & 0x0FFF; + m_nMirrorID = ( DR_TUPUS2.PRU_address & 0xF000 ) >> 8; // not 12 to create mask #else mShift = DR_TUPUS2.PRU_address; #endif #ifdef PRU_SLAVE - if( mShiftOld < mShift ) bMirrorStarted = 1; + if( mShiftOld < mShift ) bMirrorStarted = 1; #else if( mShiftOld > mShift ) bMirrorStarted = 1; -#endif +#endif mShiftOld = mShift; // Data Arrived DR_TUPUS.PRU_status++; @@ -636,18 +642,18 @@ soft_reset: while( zBuf > 0 ){ zBuf--; m_nSignal = ADC1_MAG_SS.FIFO0DATA; -# ifdef CHID_TAG_USED -# ifdef ADC_SYMUL_MODE - // The channel arrangement is out of order to present scan geometry - index = ( m_nSignal & 0xF000 ) >> 12; -# else - index = ( m_nSignal & 0xF0000 ) >> 16; -# endif -# endif +# ifdef CHID_TAG_USED +# ifdef ADC_SYMUL_MODE + // The channel arrangement is out of order to present scan geometry + index = ( m_nSignal & 0xF000 ) >> 12; +# else + index = ( m_nSignal & 0xF0000 ) >> 16; +# endif +# endif m_nSignal &= 0x00000FFF; lShift = ( cShift + index ) % TH_LINE_NODES; cSampleID = ( mShift * TH_LINE_NODES ) + lShift; -# ifdef CHECK_SUN_BIT +# ifdef CHECK_SUN_BIT if( bSunBit ){ // Clean Working Th/Learning // m_sCurrentThresholdNode.values.max = 0; @@ -655,15 +661,15 @@ soft_reset: // detector will clear values on first measure m_sCurrentThresholdNode.values.sbit = 1; m_sCurrentThresholdNode.values.cnt = 0; - #ifndef TH_PER_MIRROR - th_node[ index ][cSampleID] = m_sCurrentThresholdNode; - #else +# ifndef TH_PER_MIRROR + th_node[ index ][cSampleID] = m_sCurrentThresholdNode; +# else th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode; -#endif +# endif // Cleaning node in Working TH! - th_node[ WORKING_TH_MASK | index ][cSampleID] = m_sCurrentThresholdNode; + th_node[ WORKING_TH_MASK | index ][cSampleID] = m_sCurrentThresholdNode; } else { -# endif +# endif //m_bNodeIsChanged = 0; bDetected = 0; if( SYS_IOS.flags.mode == WMODE_DETECTION_ENABLED ){ // Detection Enabled @@ -683,7 +689,9 @@ soft_reset: //( dTargetStart[index] + bTargetWidthCNT[index] * TH_LINE_NODES ), dTargetWidth[index], bTargetWidthCNT[index], - index + index, + dTargetMin[index], + dTargetMax[index] ); m_bScanCompromised = 1; }; @@ -691,19 +699,21 @@ soft_reset: bTargetFlag[index] = 0; dTargetStart[index] = 0; dTargetEnd[index] = 0; - dTargetWidth[index] = 0; + dTargetWidth[index] = 0; bTargetWidthCNT[index] = 0; + dTargetMin[index] = 0x0FFF; + dTargetMax[index] = 0; }; }; // Get Working MinMax Values - m_sCurrentThresholdNode = th_node[ WORKING_TH_MASK | index ][cSampleID]; + m_sCurrentThresholdNode = th_node[ WORKING_TH_MASK | index ][cSampleID]; // If Working TH Node is Valid # ifdef CHECK_SUN_BIT bSunBit = th_node[ index ][cSampleID].values.sbit; if( m_sCurrentThresholdNode.values.cnt != 0 && bSunBit == 0 ){ # else if( m_sCurrentThresholdNode.values.cnt != 0 ){ -# endif +# endif // Check Current Measured Values if( m_nSignal > m_sCurrentThresholdNode.values.max ){ // Target Freeze TH Black Target @@ -713,6 +723,8 @@ soft_reset: bTargetWidthCNT[index]++; dTargetLastRange[index] = m_nSignal; bTargetFlag[index] = TARGET_BLACK; + if( m_nSignal < dTargetMin[index] ) dTargetMin[index] = m_nSignal; + if( m_nSignal > dTargetMax[index] ) dTargetMax[index] = m_nSignal; m_bScanCompromised = 1; bDetected = 1; } else if( m_nSignal < m_sCurrentThresholdNode.values.min ){ @@ -723,6 +735,8 @@ soft_reset: bTargetWidthCNT[index]++; dTargetLastRange[index] = m_nSignal; bTargetFlag[index] = TARGET_WHITE; + if( m_nSignal < dTargetMin[index] ) dTargetMin[index] = m_nSignal; + if( m_nSignal > dTargetMax[index] ) dTargetMax[index] = m_nSignal; m_bScanCompromised = 1; bDetected = 1; } else { @@ -737,7 +751,9 @@ soft_reset: //( dTargetStart[index] + bTargetWidthCNT[index] * TH_LINE_NODES ), dTargetWidth[index], bTargetWidthCNT[index], - index + index, + dTargetMin[index], + dTargetMax[index] ); m_bScanCompromised = 1; }; @@ -747,6 +763,8 @@ soft_reset: dTargetEnd[index] = 0; dTargetWidth[index] = 0; bTargetWidthCNT[index] = 0; + dTargetMin[index] = 0x0FFF; + dTargetMax[index] = 0; }; }; } else { @@ -761,7 +779,9 @@ soft_reset: //( dTargetStart[index] + bTargetWidthCNT[index] * TH_LINE_NODES ), dTargetWidth[index], bTargetWidthCNT[index], - index + index, + dTargetMin[index], + dTargetMax[index] ); m_bScanCompromised = 1; }; @@ -771,6 +791,8 @@ soft_reset: dTargetEnd[index] = 0; dTargetWidth[index] = 0; bTargetWidthCNT[index] = 0; + dTargetMin[index] = 0x0FFF; + dTargetMax[index] = 0; }; }; }; @@ -779,7 +801,7 @@ soft_reset: if( bDetected == 0 ){ /* Get Active MinMax Values */ #ifdef TH_PER_MIRROR - m_sCurrentThresholdNode = th_node[ m_nMirrorID | index ][cSampleID]; + m_sCurrentThresholdNode = th_node[ m_nMirrorID | index ][cSampleID]; #else m_sCurrentThresholdNode = th_node[ index ][cSampleID]; #endif @@ -798,7 +820,7 @@ soft_reset: }; m_sCurrentThresholdNode.values.cnt++; // cnt = 7 bit 0 - 127 #ifdef TH_PER_MIRROR - th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode; + th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode; #else th_node[ index ][cSampleID] = m_sCurrentThresholdNode; #endif @@ -809,9 +831,9 @@ soft_reset: # endif # ifndef CHID_TAG_USED index++; -# endif +# endif }; // for each LRF kernel 1 - 8 - }; // ADC1_MAG_SS.FIFO0COUNT == 8 + }; // ADC1_MAG_SS.FIFO0COUNT == 8 // Start New Scan if( bZero ){ if( m_nScanCounter < SYS_IOS.fields.flip_size && m_nFScanCounter < ( SYS_IOS.fields.flip_size << 1 ) ){ @@ -859,12 +881,12 @@ soft_reset: //m_nMirrorCounter++; if( bMirrorStarted ){ //m_nMirrorCounter >= Q_SCAN_COUNT ){ //MIRROR(1); - addTarget( MIRROR_FINISHED, 1, 0, 0, 0, 0 ); + addTarget( MIRROR_FINISHED, 1, 0, 0, 0, 0, 0, 0 ); //m_nMirrorCounter = 0; bMirrorStarted = 0; }; - }; // ADC1_MAG_SS.FIFO0COUNT > 7 - }; // SYS_IOS.flags.mode == 0 + }; // ADC1_MAG_SS.FIFO0COUNT > 7 + }; // SYS_IOS.flags.mode == 0 } else { // SYS_IOS.flags.work_en == 0 // Reset ADC conveyer before Initial Z-Marks and Startup zBuf = ADC1_MAG_SS.FIFO0COUNT; diff --git a/lib/pru/core11/targetConfigs/AM4378.ccxml b/lib/pru/core11/targetConfigs/AM4378.ccxml new file mode 100644 index 00000000..984a5b7a --- /dev/null +++ b/lib/pru/core11/targetConfigs/AM4378.ccxml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/lib/pru/core11/targetConfigs/readme.txt b/lib/pru/core11/targetConfigs/readme.txt new file mode 100644 index 00000000..af97b62d --- /dev/null +++ b/lib/pru/core11/targetConfigs/readme.txt @@ -0,0 +1,9 @@ +The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based +on the device and connection settings specified in your project on the Properties > General page. + +Please note that in automatic target-configuration management, changes to the project's device and/or +connection settings will either modify an existing or generate a new target-configuration file. Thus, +if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively, +you may create your own target-configuration file for this project and manage it manually. You can +always switch back to automatic target-configuration management by checking the "Manage the project's +target-configuration automatically" checkbox on the project's Properties > General page. \ No newline at end of file diff --git a/lib/pru/dump_console.txt b/lib/pru/dump_console.txt deleted file mode 100644 index b55ae3a0..00000000 --- a/lib/pru/dump_console.txt +++ /dev/null @@ -1,46 +0,0 @@ - -**** Clean-only build of configuration Release for project PRUSS1_PRU0 **** - -"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k clean -DEL /F "PRUSS1_PRU0.out" "PRUSS1_PRU0.hex" -DEL /F "main.d" "pru_adc.d" "pru_ggpio.d" -DEL /F "main.obj" "pru_adc.obj" "pru_ggpio.obj" -'Finished clean' -' ' - -**** Build Finished **** - -**** Build of configuration Release for project PRUSS1_PRU0 **** - -"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all -'Building file: ../main_core10.c' -'Invoking: PRU Compiler' -"C:/ti/ti-cgt-pru/bin/clpru" -v3 -Ooff --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" --symdebug:none --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --diag_wrap=off --hardware_mac=on --endian=little --preproc_with_compile --preproc_dependency="main_core10.d" "../main_core10.c" -'Finished building: ../main_core10.c' -' ' -'Building file: V:/working_dir/source/lib/hardware/soc/modules/pru/pru_adc.c' -'Invoking: PRU Compiler' -"C:/ti/ti-cgt-pru/bin/clpru" -v3 -Ooff --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" --symdebug:none --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --diag_wrap=off --hardware_mac=on --endian=little --preproc_with_compile --preproc_dependency="pru_adc.d" "V:/working_dir/source/lib/hardware/soc/modules/pru/pru_adc.c" -'Finished building: V:/working_dir/source/lib/hardware/soc/modules/pru/pru_adc.c' -' ' -'Building file: V:/working_dir/source/lib/hardware/soc/modules/pru/pru_ggpio.c' -'Invoking: PRU Compiler' -"C:/ti/ti-cgt-pru/bin/clpru" -v3 -Ooff --include_path="C:/ti/ccsv6/ccs_base/pru/include" --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" --symdebug:none --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --diag_wrap=off --hardware_mac=on --endian=little --preproc_with_compile --preproc_dependency="pru_ggpio.d" "V:/working_dir/source/lib/hardware/soc/modules/pru/pru_ggpio.c" -'Finished building: V:/working_dir/source/lib/hardware/soc/modules/pru/pru_ggpio.c' -' ' -'Building target: PRUSS1_PRU0.out' -'Invoking: PRU Linker' -"C:/ti/ti-cgt-pru/bin/clpru" -v3 -Ooff --symdebug:none --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --diag_wrap=off --hardware_mac=on --endian=little -z -m"PRUSS1_PRU0.map" --heap_size=0x100 --stack_size=0x100 -i"C:/ti/ti-cgt-pru/lib" -i"C:/ti/ti-cgt-pru/include" --reread_libs --define=ICSS1_PRU_CORE=1 --warn_sections --diag_wrap=off --display_error_number --xml_link_info="PRUSS1_PRU0_linkInfo.xml" --rom_model -o "PRUSS1_PRU0.out" "./main_core10.obj" "./pru_adc.obj" "./pru_ggpio.obj" "../AM437x_PRU_SS1.cmd" -l"C:/ti/pru/lib/rpmsg_lib.lib" -lrtspruv3_le.lib - -'Finished building target: PRUSS1_PRU0.out' -' ' -'Invoking: PRU Hex Utility' -"C:/ti/ti-cgt-pru/bin/hexpru" --byte --intel -o "PRUSS1_PRU0.hex" "PRUSS1_PRU0.out" -Translating to Intel format... - "PRUSS1_PRU0.out" .text:_c_int00* ==> .text:_c_int00* - "PRUSS1_PRU0.out" .text ==> .text - "PRUSS1_PRU0.out" .resource_table ==> .resource_table -'Finished building: PRUSS1_PRU0.hex' -' ' - -**** Build Finished **** diff --git a/lib/pru/gogi.txt b/lib/pru/gogi.txt deleted file mode 100644 index c1f474f3..00000000 --- a/lib/pru/gogi.txt +++ /dev/null @@ -1,51 +0,0 @@ -NETWORK_SERVER : -{ - NW_HOSTNAME_IP = "192.168.1.63"; - NW_LISTEN_PORT = 2222; -}; -HARDWARE_MANAGER : -{ - MASTER_ROLE = true; - LRF_ENABLED = true; - SIG_SYM_ENABLE = false; - MOTORS_AUTOSTART = true; - VERTICAL_ENC_FREQ = 57600; - HORIZONTAL_ENC_FREQ = 4000; - VERTICAL_MOTOR_CTRL = true; - HORIZONTAL_MOTOR_CTRL = true; - LRF_PULSES_INTERLEAVE = 4; - TH_OFFSET = 64; - TH_ORDER = 3; - TH_DELTA = 32; - TH_FLIP = 16; - TH_GOOD_POINTS = 4; - CAN_BUS_ENABLE = true; - CAN_BUS_ID = 1; - CAN_MY_ID = 768; - CAN_TGZ_ID = 769; - TH_GENERATED_BY_PRU = false; - DUMP_TH_ON_DISK = false; - TH_SPIKE_SIZE = 0; - TGZ_MIRROR_SPEED = 14400; - TGZ_BASE_SPEED = 1750; - SUNBIT_ENABLE = true; - BASE_SHIFT = 0; - MIRROR_SHIFT = 0; -}; -KERNEL : -{ - ENABLE_SAFE_SHORE = false; - DETECTOR_WIDTH = 20; - DETECTOR_SST = 0; - SAFESHORE_CONNECTION : - { - SCANNER_NAME = "LRF_3D_001"; - SCANNER_DIMENTIONS = 3; - LCU_IP_ADDRESS = "192.168.1.11"; - LCU_IP_PORT = 8008; - }; -}; -PROTOCOL : -{ -}; - diff --git a/lib/pru/main.d b/lib/pru/main.d deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/pru/out.log b/lib/pru/out.log deleted file mode 100644 index a4e637b0..00000000 --- a/lib/pru/out.log +++ /dev/null @@ -1,2 +0,0 @@ - ->> Compilation failure diff --git a/lib/pru/out.txt b/lib/pru/out.txt deleted file mode 100644 index 1e0c6d1e..00000000 --- a/lib/pru/out.txt +++ /dev/null @@ -1,54 +0,0 @@ - -D:\Sources_TEMP\FruchtSystems\lib\pru>set PATH=C:\ti\ti-cgt-pru\bin;C:\Program Files\Far Manager\;C:\Program Files\GnuWin32\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\libnvvp\;C:\Python27\;C:\Python27\Scripts;C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\WinMerge;C:\Program Files\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\CSR\CSR Harmony Wireless Software Stack\;C:\Program Files\Nordic Semiconductor\nrf51\bin\;C:\Program Files\Subversion\bin;c:\MoSync\bin;D:\PHP55-GTK2;C:\wamp\bin\php\php5.3.5;C:\Python27;C:\CooCox\CoIDE_V2Beta\gcc\bin;C:\CooCox\CoIDE_V2Beta\bin;C:\Program Files\Skype\Phone\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;E:\Linaro_Releases\gcc\bin;E:\Linaro_Releases\gcc\arm-linux-gnueabihf\bin;C:\Program Files\SlickEditV16.0.0\win\;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\progra~1\BC45\BIN;E:\Android\PhoenixSuit_V1.10\PhoenixSuit_V1.10\;C:\Documents and Settings\gagua\Application Data\npm - -D:\Sources_TEMP\FruchtSystems\lib\pru>del PRUSS1_PRU1.out - -D:\Sources_TEMP\FruchtSystems\lib\pru>cd CORE11 - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>del *.d - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>del *.obj - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>del *.out - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>del *.map - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>del *.xml -'Building file: main.c' -'Invoking: PRU Compiler' - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=far --endian=little --preproc_with_compile --preproc_dependency="main.d" "main_core11.c" -FILE: main_core11.obj -CODE size (bytes): 4780 -CONST size (bytes): 448 -DATA size (bytes): 6460 - - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=far --endian=little --preproc_with_compile --preproc_dependency="pru_motors.d" "../../hardware/soc/modules/pru/pru_motors.c" -FILE: pru_motors.obj -CODE size (bytes): 688 -DATA size (bytes): 7398 - - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=far --endian=little --preproc_with_compile --preproc_dependency="pru_ggpio.d" "../../hardware/soc/modules/pru/pru_ggpio.c" -FILE: pru_ggpio.obj -CODE size (bytes): 136 - - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=far --endian=little --preproc_with_compile --preproc_dependency="pru_time.d" "../../hardware/soc/modules/pru/pru_time.c" -FILE: pru_time.obj -CODE size (bytes): 104 -CONST size (bytes): 8 -DATA size (bytes): 5664 - - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -O2 --include_path="C:/ti/pru/include" --include_path="C:/ti/pru/include/am437x" --include_path="C:/ti/ti-cgt-pru/include" -g --define=am4378 --define=icss1 --define=pru0 --display_error_number --diag_warning=225 --section_sizes=on --diag_wrap=off --hardware_mac=on --mem_model:data=far --endian=little --preproc_with_compile --preproc_dependency="tupus_ext.d" "../../hardware/soc/modules/pru/tupus_ext.c" -'Finished building: CORE10' -' ' -'Building target: OUT_CCA1.out' -'Invoking: PRU Linker' - -D:\Sources_TEMP\FruchtSystems\lib\pru\core11>"C:/ti/ti-cgt-pru/bin/clpru" -v3 -Ooff --symdebug:none --define=am4378 --define=icss1 --define=pru1 --display_error_number --diag_warning=225 --diag_wrap=off --hardware_mac=on --endian=little -z -m"PRUSS1_PRU1.map" --heap_size=0x100 --stack_size=0x100 -i"C:/ti/ti-cgt-pru/lib" -i"C:/ti/ti-cgt-pru/include" -l"C:/ti/pru/lib/rpmsg_lib.lib" -lrtspruv3_le.lib --reread_libs --define=ICSS1_PRU_CORE=1 --warn_sections --diag_wrap=off --display_error_number --xml_link_info="PRUSS1_PRU1_linkInfo.xml" --rom_model -o "../PRUSS1_PRU1.out" "main_core11.obj" "pru_ggpio.obj" "pru_motors.obj" "pru_time.obj" "tupus_ext.obj" "AM437x_PRU_SS1.cmd" -llibc.a - -'Finished building target: OUT_CCA1.out' -' '