Changeset 4 in pacpussensors


Ignore:
Timestamp:
Jun 7, 2013, 12:10:00 AM (11 years ago)
Author:
guyardro
Message:

add igep can driver for CanGateway and add support for igep compilation

Location:
trunk
Files:
13 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r1 r4  
    4545endif()
    4646
     47    include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake)
     48    include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake)
     49    include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake)
     50    include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake)
    4751
    4852# ========================================
     
    7478endif(QT4_FOUND)
    7579
     80include_directories(
     81  ${PACPUS_DEPENDENCIES_INC}
     82  ${PACPUS_INCLUDE_DIR}
     83  ${PACPUS_INCLUDE_HINT}
     84  ${PACPUS_INCLUDE_HINT}/Pacpus
     85  ./PACPUS/include
     86)
    7687
    7788# ========================================
    7889# Build the PacpusSensors' modules
    7990# ========================================
    80 add_subdirectory(Alasca)
     91#add_subdirectory(Alasca)
    8192add_subdirectory(CanGateway)
    8293
  • trunk/CanGateway/CMakeLists.txt

    r2 r4  
    5656        DbtRawCanReader.h
    5757    DbtRawCanReader.cpp
     58        structureCan.h
    5859    ${PLUGIN_CPP}
    5960)
     
    6970if(UNIX)
    7071    list(APPEND PROJECT_SRCS
    71         driver/PeakCanDriver.cpp
     72#        driver/PeakCanDriver.cpp
    7273        driver/PeakCanDriver.h
     74        driver/igepCanDriver.h
     75        driver/igepCanDriver.cpp
    7376    )
    7477endif(UNIX)
     
    126129    set(LIBS
    127130        # add your specific libraries to link here
    128         pcan
     131       # pcan
    129132    )
    130133endif(UNIX)
     
    137140        ${PACPUS_DEPENDENCIES_LIB}
    138141        ${LIBS}
    139         PacpusTools
     142#       PacpusTools
    140143)
    141144
  • trunk/CanGateway/CanDecoderBase.h

    r2 r4  
    1919#include "Pacpus/kernel/ComponentBase.h"
    2020#include "CanFrame.h"
     21#include "structureCan.h"
    2122
    2223namespace pacpus {
  • trunk/CanGateway/CanGateway.cpp

    r2 r4  
    8585      qFatal("Failed to open the CAN interface port %s in %s mode",port_, accessMode_);
    8686  }
     87  else if (source_ == "igep")
     88  {
     89    canIf_.setSource(Win32CanInterface::igepCard);
     90    // open interface
     91    if (canIf_.openInterface(port_, accessMode_)==0)
     92      qFatal("Failed to open the CAN interface port %s in %s mode",port_, accessMode_);
     93  }
    8794  else
    8895  {
     
    107114  counter_ = 0;
    108115  canIf_.stop();
    109   if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL"))
     116  if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL")||(source_=="igep"))
    110117    canIf_.closeInterface(channel_);
    111118  canIf_.wait();
     
    182189    setState(ComponentBase::MONITOR_OK);
    183190
    184         //printf("id:%x\n",incomingCanFrames_[counter_].frame.id);
     191//      printf("id:%x\n",incomingCanFrames_[counter_].frame.id);
    185192
    186193   /* switch (incomingCanFrames_[counter_].frame.id)
  • trunk/CanGateway/CanGateway.h

    r2 r4  
    4646  virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    4747
     48virtual  Win32CanInterface* getCanIf()
     49{
     50        return &canIf_;
     51}
     52
    4853protected:
    4954  void run();
  • trunk/CanGateway/Win32CanInterface.cpp

    r2 r4  
    109109    peakLoop();
    110110    break;
     111  case igepCard:
     112    igepLoop();
     113    break;
    111114  case XLVectorCard:
    112115    vectorXlLoop();
     
    200203
    201204/************************************************************************/
     205/// The loop used for waiting CAN data from igep card
     206void Win32CanInterface::igepLoop()
     207{
     208  std::cout << "In igep loop" << std::endl;
     209
     210  while(continue_)
     211  {
     212    // Wait incoming data from the CAN bus
     213    if ( canDriver_->receiveFrame(frame_) == 0 ) {
     214      receivedFrames_[counter_].time = road_time();
     215      receivedFrames_[counter_].timerange = 0;
     216      memcpy(&(receivedFrames_[counter_].frame), &frame_, sizeof(CanFrame) );
     217      semaphore_->release();
     218      counter_++;
     219      counter_ = counter_ % receivedFramesArraySize_;
     220    }
     221  }
     222}
     223/************************************************************************/
    202224/// Stops the thread
    203225void Win32CanInterface::stop()
  • trunk/CanGateway/Win32CanInterface.h

    r2 r4  
    2020#   define CAN_DRIVER_TYPE       VECTOR_CANXL_DRIVER
    2121#else
    22 #   define CAN_DRIVER_TYPE       PEAK_CAN_DRIVER
     22#   define CAN_DRIVER_TYPE       IGEP_CAN_DRIVER
    2323#endif
    2424
     
    3030
    3131#include "driver/CanDriver.h"
     32#include "structureCan.h"
    3233
    3334namespace pacpus {
     
    4243  ~Win32CanInterface();
    4344
    44   enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard};
     45  enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard, igepCard};
    4546
    4647  bool openInterface(const int number, const unsigned int speed);
     
    5859  void shMemLoop();
    5960  void peakLoop();
     61  void igepLoop();
    6062  void vectorXlLoop();
    6163
  • trunk/CanGateway/driver/CanDriver.h

    r1 r4  
    2323#define NI_CAN_DRIVER         2
    2424#define VECTOR_CANXL_DRIVER         3
     25#define  PEAK_CAN_DRIVER 4
     26#define  IGEP_CAN_DRIVER 5     
    2527
    2628
     
    3436#include "PeakCanDriver.h"
    3537#define CanDriverType PeakCanDriver
     38#elif CAN_DRIVER_TYPE == IGEP_CAN_DRIVER
     39#include "igepCanDriver.h"
     40#define CanDriverType igepCanDriver
    3641#elif CAN_DRIVER_TYPE == VECTOR_CANXL_DRIVER
    3742#include "XLVectorCanDriver.h"
  • trunk/CanGateway/driver/CanDriverBase.h

    r2 r4  
    2020#include "Pacpus/PacpusTools/BinaryDecoder.h"
    2121
     22#include "../structureCan.h"
    2223
    2324/*
Note: See TracChangeset for help on using the changeset viewer.