pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


jncg-tle-ecu-@(codesys|jobct)l-fix20181025
Posted by Anonymous on Thu 25th Oct 2018 14:49
raw | new post

  1. diff --git a/ptxdist/configs/ecu02/ptxconfig b/ptxdist/configs/ecu02/ptxconfig
  2. index 7814817..5ddc16e 100644
  3. --- a/ptxdist/configs/ecu02/ptxconfig
  4. +++ b/ptxdist/configs/ecu02/ptxconfig
  5. @@ -2220,19 +2220,8 @@ PTXCONF_USBMOUNT_SYSTEMD_UNIT=y
  6.  # PTXCONF_VPNC is not set
  7.  # PTXCONF_SMSTOOLS3 is not set
  8.  # PTXCONF_EUPDATE is not set
  9. -PTXCONF_CODESYS3_RT=y
  10. -PTXCONF_CODESYS3_RT_ARM=y
  11. +# PTXCONF_CODESYS3_RT_ARM is not set
  12.  # PTXCONF_CODESYS3_RT_X86 is not set
  13. -# PTXCONF_CODESYS3_RT_TARGETVISU is not set
  14. -# PTXCONF_CODESYS3_RT_DEBUG_VERSION is not set
  15. -PTXCONF_CODESYS3_RT_BIN_PATH="/usr/bin"
  16. -PTXCONF_CODESYS3_RT_LIB_PATH="/usr/lib"
  17. -PTXCONF_CODESYS3_RT_EXECUTABLE="codesyscontrol"
  18. -PTXCONF_CODESYS3_RT_HOME="/home"
  19. -PTXCONF_CODESYS3_RT_APP="Application.app"
  20. -PTXCONF_CODESYS3_RT_OUTPUT="/dev/console"
  21. -PTXCONF_CODESYS3_RT_SYSTEMD_UNIT=y
  22. -# PTXCONF_CODESYS3_RT_SYSTEMD_MULTIUSER_TARGET is not set
  23.  
  24.  #
  25.  # System Tools                          
  26. @@ -2271,8 +2260,7 @@ PTXCONF_CODESYS3_RT_SYSTEMD_UNIT=y
  27.  #
  28.  PTXCONF_ECU_BASICSYS=y
  29.  # PTXCONF_ECU_EXPLORE is not set
  30. -PTXCONF_ECU_CODESYS=y
  31. -# PTXCONF_ECU_JOBCTL is not set
  32. +PTXCONF_ECU_JOBCTL=y
  33.  # PTXCONF_ECU_JOBCTL_AXENT is not set
  34.  # PTXCONF_ECU_JOBCTL_AXIS is not set
  35.  PTXCONF_ECU_JOBCTL_DEMO=y
  36. @@ -2287,10 +2275,10 @@ PTXCONF_ECU_CONTROL=y
  37.  # PTXCONF_ECU01_CODESYS is not set
  38.  # PTXCONF_ECU01_MOTOR_CTL is not set
  39.  # PTXCONF_ECU01_COMP_CAP is not set
  40. -# PTXCONF_ECU01_MMC is not set
  41.  # PTXCONF_LIBVT is not set
  42.  # PTXCONF_QADRIVER is not set
  43.  # PTXCONF_POWER_BUTTON is not set
  44. +# PTXCONF_ADS7953 is not set
  45.  # PTXCONF_TESTSTAND is not set
  46.  # PTXCONF_ECU01_CONTROL is not set
  47.  
  48. diff --git a/ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp b/ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp
  49. index 3563e23..23a7d78 100644
  50. --- a/ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp
  51. +++ b/ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp
  52. @@ -904,47 +904,58 @@ void copyMaxToProcessImage( Ecu02Max116x::MAX116XX_CHANNEL_DATA *max_data )
  53.     ECU02_INS->FB_HB_2 = max_data->data[15];
  54.  }
  55.  
  56. -void readFeedbackHSPwm( void )
  57. +/*
  58. + * This functionality is duplicated in:
  59. + * - ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp, function IODriver::readFeedbackHSPwm()
  60. + * - ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp, function readFeedbackHSPwm()
  61. + */
  62. +void readFeedbackHSPwm(void)
  63.  {
  64. -   unsigned long tleFeedbackCh0;
  65. -   unsigned long tleFeedbackCh1;
  66. -   unsigned long tleFeedbackCh2;
  67. -   bool ok1,ok2,ok3;
  68. -
  69. -   ok1 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH0,tleFeedbackCh0 );
  70. -   ok2 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH1,tleFeedbackCh1 );
  71. -   ok3 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH2,tleFeedbackCh2 );
  72. -   if ( ok1 && ok2 && ok3 ){
  73. -
  74. -      unsigned long currentFeedback0 = (tleFeedbackCh0 & 0x00fff000) >> 12;
  75. -      unsigned long periodFeedback0  = (tleFeedbackCh0 & 0x00000fff);
  76. -      unsigned short powerMa0 = 0;
  77. -      unsigned long currentFeedback1 = (tleFeedbackCh1 & 0x00fff000) >> 12;
  78. -      unsigned long periodFeedback1 = (tleFeedbackCh1 & 0x00000fff);
  79. -      unsigned short powerMa1 = 0;
  80. -      unsigned long currentFeedback2 = (tleFeedbackCh2 & 0x00fff000) >> 12;
  81. -      unsigned long periodFeedback2 = (tleFeedbackCh2 & 0x00000fff);
  82. -      unsigned short powerMa2 = 0;
  83. -
  84. -      /* Average load current = 0.75 * CurrentFB / PeriodFB
  85. -       *  1000 ~ A -> mA
  86. -       *  3 / 4 ~ 0,75
  87. -       */
  88. -      if( periodFeedback0 != 0 ){
  89. -         powerMa0 = (currentFeedback0 * 3000) / (periodFeedback0 * 4);
  90. -      }
  91. -
  92. -      if( periodFeedback1 != 0 ){
  93. -         powerMa1 = (currentFeedback1 * 3000) / (periodFeedback1 * 4);
  94. -      }
  95. -
  96. -      if( periodFeedback2 != 0 ){
  97. -         powerMa2 = (currentFeedback2 * 3000) / (periodFeedback2 * 4);
  98. -      }
  99. -      ECU02_INS->FB_HS_PWM1 = powerMa0;
  100. -      ECU02_INS->FB_HS_PWM2 = powerMa1;
  101. -      ECU02_INS->FB_HS_PWM3 = powerMa2;
  102. -   }
  103. +       unsigned long   currentFeedback0;
  104. +       unsigned long   periodFeedback0;
  105. +       unsigned long   currentFeedback1;
  106. +       unsigned long   periodFeedback1;
  107. +       unsigned long   currentFeedback2;
  108. +       unsigned long   periodFeedback2;
  109. +       bool            ok0,
  110. +                       ok1,
  111. +                       ok2;
  112. +       unsigned short  powerMa0 = 0;
  113. +       unsigned short  powerMa1 = 0;
  114. +       unsigned short  powerMa2 = 0;
  115. +
  116. +       ok0 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH0, currentFeedback0, periodFeedback0);
  117. +       ok1 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH1, currentFeedback1, periodFeedback1);
  118. +       ok2 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH2, currentFeedback2, periodFeedback2);
  119. +       if (!(ok0 && ok1 && ok2))
  120. +               return;
  121. +
  122. +       /*
  123. +        * Average load current = 0.75 * CurrentFB / PeriodFB
  124. +        *      1000 ~ A -> mA
  125. +        *      3 / 4 ~ 0,75
  126. +        */
  127. +#define AVERAGE_LOAD_CURRENT(currentFeedback, periodFeedback) \
  128. +       (((currentFeedback) * 3000UL) / ((periodFeedback) * 4UL))
  129. +
  130. +       if (periodFeedback0 != 0)
  131. +       {
  132. +               powerMa0 = AVERAGE_LOAD_CURRENT(currentFeedback0, periodFeedback0);
  133. +       }
  134. +
  135. +       if (periodFeedback1 != 0)
  136. +       {
  137. +               powerMa1 = AVERAGE_LOAD_CURRENT(currentFeedback1, periodFeedback1);
  138. +       }
  139. +
  140. +       if (periodFeedback2 != 0)
  141. +       {
  142. +               powerMa2 = AVERAGE_LOAD_CURRENT(currentFeedback2, periodFeedback2);
  143. +       }
  144. +
  145. +       ECU02_INS->FB_HS_PWM1 = powerMa0;
  146. +       ECU02_INS->FB_HS_PWM2 = powerMa1;
  147. +       ECU02_INS->FB_HS_PWM3 = powerMa2;
  148.  }
  149.  
  150.  static void threadIO(SYS_TASK_PARAM *ptp)
  151. diff --git a/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.cpp b/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.cpp
  152. index d70b823..d3c443f 100644
  153. --- a/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.cpp
  154. +++ b/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.cpp
  155. @@ -319,6 +319,7 @@ unsigned long Ecu02ClkDividerParameters::rawValue() const
  156.  
  157.  Ecu02Tle::Ecu02Tle() :
  158.     _hdl(-1),
  159. +   _icVersion(0xDEADBEEF),
  160.     _hdl_mutex()
  161.  {
  162.    
  163. @@ -343,17 +344,31 @@ Ecu02Tle::~Ecu02Tle()
  164.  
  165.  void Ecu02Tle::init(unsigned long value)
  166.  {
  167. -    /* value == rawValue of Clk Divider Regsiter */
  168. +       /* value == rawValue of Clk Divider Regsiter */
  169.  
  170. -    pthread_mutex_lock(&_hdl_mutex);
  171. -    _hdl = open( TLE82353SA_DEVICEPATH, O_RDWR );
  172. -    if( isOpen() ){
  173. -       if( ! TLE82353SA::initTLE( _hdl, value, true, true ) ){
  174. -          close(_hdl);
  175. -          _hdl = -1;
  176. -       }
  177. -    }
  178. -    pthread_mutex_unlock(&_hdl_mutex);
  179. +       (void)pthread_mutex_lock(&_hdl_mutex);
  180. +
  181. +       _hdl = open( TLE82353SA_DEVICEPATH, O_RDWR );
  182. +       if (_hdl >= 0)
  183. +       {
  184. +               bool ok = false;
  185. +
  186. +               if (TLE82353SA::initTLE(_hdl, value, true, true))
  187. +               {
  188. +                       if (TLE82353SA::readICVersion(_hdl, _icVersion))
  189. +                       {
  190. +                               ok = true;
  191. +                       }
  192. +               }
  193. +
  194. +               if (!ok)
  195. +               {
  196. +                       (void)close(_hdl);
  197. +                       _hdl = -1;
  198. +               }
  199. +       }
  200. +
  201. +       (void)pthread_mutex_unlock(&_hdl_mutex);
  202.  }
  203.  
  204.  bool Ecu02Tle::isOpen() const
  205. @@ -475,6 +490,52 @@ bool Ecu02Tle::setChannelValue(int channel, int current_value, int pwm_value)
  206.     return bRet;
  207.  }
  208.  
  209. +
  210. +bool Ecu02Tle::readFeedbackRegister(unsigned char adr, unsigned long &currentfb_value, unsigned long &periodfb_value)
  211. +{
  212. +       unsigned long fbrv; /* feedback register value */
  213. +
  214. +       /*
  215. +        * Handle a functional change in the TLE82353SA between chip version
  216. +        * B13 and chip version C11.
  217. +        *
  218. +        * In version C11 the "Current FB" value (bits 23:12) of registers 0x40,
  219. +        * 0x41 and 0x41 needs to be multiplied by factor 2 compared to the older
  220. +        * chip version B13.
  221. +        *
  222. +        * Fortunately the chip version can be used to distinguish between
  223. +        * both versions via |_icVersion|.
  224. +        */
  225. +
  226. +       /*
  227. +        * |readFeedbackRegister()| is for currentFB registers only, so bail
  228. +        * out if someone asks for something else we cannot handle
  229. +        */
  230. +       if ((adr != 0x40) && (adr != 0x41) && (adr != 0x42))
  231. +               return false;
  232. +
  233. +       if (!readRegister(adr, fbrv))
  234. +               return false;
  235. +
  236. +       switch(_icVersion)
  237. +       {
  238. +               case 4: /* B13 step = 00000100 */
  239. +                       currentfb_value = (fbrv & 0x00FFF000) >> 12;
  240. +                       periodfb_value  = (fbrv & 0x00000FFF);
  241. +                       return true;
  242. +               case 6: /* C11 step = 00000110 */
  243. +                       currentfb_value = (fbrv & 0x00FFF000) >> 12;
  244. +                       periodfb_value  = (fbrv & 0x00000FFF);
  245. +                       currentfb_value *= 2;
  246. +                       return true;
  247. +               default: /* unknown chip version, we return |false| below */
  248. +                       break;
  249. +       }
  250. +
  251. +       return false;
  252. +}
  253. +
  254. +
  255.  /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*
  256.  Ecu02Tle
  257.  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*/
  258. diff --git a/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.h b/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.h
  259. index 224062c..9fff6b6 100644
  260. --- a/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.h
  261. +++ b/ptxdist/local_src/ecu-codesys/io_driver/ecu02tle.h
  262. @@ -148,8 +148,10 @@ public:
  263.     bool writeRegister( unsigned char adr, unsigned long value );
  264.     bool readRegister( unsigned char adr, unsigned long &value );
  265.    
  266. +   bool readFeedbackRegister(unsigned char adr, unsigned long &currentfb_value, unsigned long &periodfb_value);
  267. +
  268.     bool setChannelValue(int channel, int current_value, int pwm_value );
  269. -  
  270. +
  271.     void init(unsigned long value);
  272.  
  273.  private:
  274. @@ -157,6 +159,7 @@ private:
  275.     Ecu02Tle();
  276.    
  277.     int _hdl;
  278. +   unsigned long _icVersion;
  279.     pthread_mutex_t _hdl_mutex;
  280.  };
  281.  
  282. diff --git a/ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp b/ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp
  283. index 6f07f70..2cd095b 100644
  284. --- a/ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp
  285. +++ b/ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp
  286. @@ -562,47 +562,58 @@ void IODriver::copyMaxToProcessImage( void* t )
  287.     }
  288.  }
  289.  
  290. -void IODriver::readFeedbackHSPwm( void )
  291. +/*
  292. + * This functionality is duplicated in:
  293. + * - ptxdist/local_src/ecu-jobctl/platform/iodriver/IODriver.cpp, function IODriver::readFeedbackHSPwm()
  294. + * - ptxdist/local_src/ecu-codesys/io_driver/IODriverECU02.cpp, function readFeedbackHSPwm()
  295. + */
  296. +void IODriver::readFeedbackHSPwm(void)
  297.  {
  298. -   unsigned long tleFeedbackCh0;
  299. -   unsigned long tleFeedbackCh1;
  300. -   unsigned long tleFeedbackCh2;
  301. -   bool ok1,ok2,ok3;
  302. -
  303. -   ok1 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH0,tleFeedbackCh0 );
  304. -   ok2 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH1,tleFeedbackCh1 );
  305. -   ok3 = Ecu02Tle::getInst().readRegister(REGISTER_FEEDBACK_CH2,tleFeedbackCh2 );
  306. -   if ( ok1 && ok2 && ok3 ){
  307. -
  308. -      unsigned long currentFeedback0 = (tleFeedbackCh0 & 0x00fff000) >> 12;
  309. -      unsigned long periodFeedback0  = (tleFeedbackCh0 & 0x00000fff);
  310. -      unsigned short powerMa0 = 0;
  311. -      unsigned long currentFeedback1 = (tleFeedbackCh1 & 0x00fff000) >> 12;
  312. -      unsigned long periodFeedback1 = (tleFeedbackCh1 & 0x00000fff);
  313. -      unsigned short powerMa1 = 0;
  314. -      unsigned long currentFeedback2 = (tleFeedbackCh2 & 0x00fff000) >> 12;
  315. -      unsigned long periodFeedback2 = (tleFeedbackCh2 & 0x00000fff);
  316. -      unsigned short powerMa2 = 0;
  317. -
  318. -      /* Average load current = 0.75 * CurrentFB / PeriodFB
  319. -       *  1000 ~ A . mA
  320. -       *  3 / 4 ~ 0,75
  321. -       */
  322. -      if( periodFeedback0 != 0 ){
  323. -         powerMa0 = (currentFeedback0 * 3000) / (periodFeedback0 * 4);
  324. -      }
  325. -
  326. -      if( periodFeedback1 != 0 ){
  327. -         powerMa1 = (currentFeedback1 * 3000) / (periodFeedback1 * 4);
  328. -      }
  329. -
  330. -      if( periodFeedback2 != 0 ){
  331. -         powerMa2 = (currentFeedback2 * 3000) / (periodFeedback2 * 4);
  332. -      }
  333. -      ECU02_INS.FB_HS_PWM1 = powerMa0;
  334. -      ECU02_INS.FB_HS_PWM2 = powerMa1;
  335. -      ECU02_INS.FB_HS_PWM3 = powerMa2;
  336. -   }
  337. +       unsigned long   currentFeedback0;
  338. +       unsigned long   periodFeedback0;
  339. +       unsigned long   currentFeedback1;
  340. +       unsigned long   periodFeedback1;
  341. +       unsigned long   currentFeedback2;
  342. +       unsigned long   periodFeedback2;
  343. +       bool            ok0,
  344. +                       ok1,
  345. +                       ok2;
  346. +       unsigned short  powerMa0 = 0;
  347. +       unsigned short  powerMa1 = 0;
  348. +       unsigned short  powerMa2 = 0;
  349. +
  350. +       ok0 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH0, currentFeedback0, periodFeedback0);
  351. +       ok1 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH1, currentFeedback1, periodFeedback1);
  352. +       ok2 = Ecu02Tle::getInst().readFeedbackRegister(REGISTER_FEEDBACK_CH2, currentFeedback2, periodFeedback2);
  353. +       if (!(ok0 && ok1 && ok2))
  354. +               return;
  355. +
  356. +       /*
  357. +        * Average load current = 0.75 * CurrentFB / PeriodFB
  358. +        *      1000 ~ A -> mA
  359. +        *      3 / 4 ~ 0,75
  360. +        */
  361. +#define AVERAGE_LOAD_CURRENT(currentFeedback, periodFeedback) \
  362. +       (((currentFeedback) * 3000UL) / ((periodFeedback) * 4UL))
  363. +
  364. +       if (periodFeedback0 != 0)
  365. +       {
  366. +               powerMa0 = AVERAGE_LOAD_CURRENT(currentFeedback0, periodFeedback0);
  367. +       }
  368. +
  369. +       if (periodFeedback1 != 0)
  370. +       {
  371. +               powerMa1 = AVERAGE_LOAD_CURRENT(currentFeedback1, periodFeedback1);
  372. +       }
  373. +
  374. +       if (periodFeedback2 != 0)
  375. +       {
  376. +               powerMa2 = AVERAGE_LOAD_CURRENT(currentFeedback2, periodFeedback2);
  377. +       }
  378. +
  379. +       ECU02_INS.FB_HS_PWM1 = powerMa0;
  380. +       ECU02_INS.FB_HS_PWM2 = powerMa1;
  381. +       ECU02_INS.FB_HS_PWM3 = powerMa2;
  382.  }
  383.  
  384.  
  385. diff --git a/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.cpp b/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.cpp
  386. index 3e00896..5ca9825 100644
  387. --- a/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.cpp
  388. +++ b/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.cpp
  389. @@ -319,6 +319,7 @@ unsigned long Ecu02ClkDividerParameters::rawValue() const
  390.  
  391.  Ecu02Tle::Ecu02Tle() :
  392.     _hdl(-1),
  393. +   _icVersion(0xDEADBEEF),
  394.     _hdl_mutex()
  395.  {
  396.    
  397. @@ -343,17 +344,31 @@ Ecu02Tle::~Ecu02Tle()
  398.  
  399.  void Ecu02Tle::init(unsigned long value)
  400.  {
  401. -    /* value == rawValue of Clk Divider Regsiter */
  402. +       /* value == rawValue of Clk Divider Regsiter */
  403.  
  404. -    pthread_mutex_lock(&_hdl_mutex);
  405. -    _hdl = open( TLE82353SA_DEVICEPATH, O_RDWR );
  406. -    if( isOpen() ){
  407. -       if( ! TLE82353SA::initTLE( _hdl, value, true, true ) ){
  408. -          close(_hdl);
  409. -          _hdl = -1;
  410. -       }
  411. -    }
  412. -    pthread_mutex_unlock(&_hdl_mutex);
  413. +       (void)pthread_mutex_lock(&_hdl_mutex);
  414. +
  415. +       _hdl = open( TLE82353SA_DEVICEPATH, O_RDWR );
  416. +       if (_hdl >= 0)
  417. +       {
  418. +               bool ok = false;
  419. +
  420. +               if (TLE82353SA::initTLE(_hdl, value, true, true))
  421. +               {
  422. +                       if (TLE82353SA::readICVersion(_hdl, _icVersion))
  423. +                       {
  424. +                               ok = true;
  425. +                       }
  426. +               }
  427. +
  428. +               if (!ok)
  429. +               {
  430. +                       (void)close(_hdl);
  431. +                       _hdl = -1;
  432. +               }
  433. +       }
  434. +
  435. +       (void)pthread_mutex_unlock(&_hdl_mutex);
  436.  }
  437.  
  438.  bool Ecu02Tle::isOpen() const
  439. @@ -475,6 +490,52 @@ bool Ecu02Tle::setChannelValue(int channel, int current_value, int pwm_value)
  440.     return bRet;
  441.  }
  442.  
  443. +
  444. +bool Ecu02Tle::readFeedbackRegister(unsigned char adr, unsigned long &currentfb_value, unsigned long &periodfb_value)
  445. +{
  446. +       unsigned long fbrv; /* feedback register value */
  447. +
  448. +       /*
  449. +        * Handle a functional change in the TLE82353SA between chip version
  450. +        * B13 and chip version C11.
  451. +        *
  452. +        * In version C11 the "Current FB" value (bits 23:12) of registers 0x40,
  453. +        * 0x41 and 0x41 needs to be multiplied by factor 2 compared to the older
  454. +        * chip version B13.
  455. +        *
  456. +        * Fortunately the chip version can be used to distinguish between
  457. +        * both versions via |_icVersion|.
  458. +        */
  459. +
  460. +       /*
  461. +        * |readFeedbackRegister()| is for currentFB registers only, so bail
  462. +        * out if someone asks for something else we cannot handle
  463. +        */
  464. +       if ((adr != 0x40) && (adr != 0x41) && (adr != 0x42))
  465. +               return false;
  466. +
  467. +       if (!readRegister(adr, fbrv))
  468. +               return false;
  469. +
  470. +       switch(_icVersion)
  471. +       {
  472. +               case 4: /* B13 step = 00000100 */
  473. +                       currentfb_value = (fbrv & 0x00FFF000) >> 12;
  474. +                       periodfb_value  = (fbrv & 0x00000FFF);
  475. +                       return true;
  476. +               case 6: /* C11 step = 00000110 */
  477. +                       currentfb_value = (fbrv & 0x00FFF000) >> 12;
  478. +                       periodfb_value  = (fbrv & 0x00000FFF);
  479. +                       currentfb_value *= 2;
  480. +                       return true;
  481. +               default: /* unknown chip version, we return |false| below */
  482. +                       break;
  483. +       }
  484. +
  485. +       return false;
  486. +}
  487. +
  488. +
  489.  /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*
  490.  Ecu02Tle
  491.  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*/
  492. diff --git a/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.h b/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.h
  493. index 224062c..db65a02 100644
  494. --- a/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.h
  495. +++ b/ptxdist/local_src/ecu-jobctl/platform/iodriver/ecu02tle.h
  496. @@ -147,7 +147,9 @@ public:
  497.    
  498.     bool writeRegister( unsigned char adr, unsigned long value );
  499.     bool readRegister( unsigned char adr, unsigned long &value );
  500. -  
  501. +
  502. +   bool readFeedbackRegister(unsigned char adr, unsigned long &currentfb_value, unsigned long &periodfb_value);
  503. +
  504.     bool setChannelValue(int channel, int current_value, int pwm_value );
  505.    
  506.     void init(unsigned long value);
  507. @@ -157,6 +159,7 @@ private:
  508.     Ecu02Tle();
  509.    
  510.     int _hdl;
  511. +   unsigned long _icVersion;
  512.     pthread_mutex_t _hdl_mutex;
  513.  };
  514.  
  515. diff --git a/ptxdist/rules/ecu-codesys.make b/ptxdist/rules/ecu-codesys.make
  516. index 5d2b021..df0efb9 100644
  517. --- a/ptxdist/rules/ecu-codesys.make
  518. +++ b/ptxdist/rules/ecu-codesys.make
  519. @@ -102,7 +102,8 @@ $(STATEDIR)/ecu-codesys.targetinstall:
  520.         @$(call install_replace, ecu-codesys, /sbin/update-ecu-codesys-application.sh, @ECU_PATH_ON_STICK@, "ecu02" )
  521.         @$(call install_copy, ecu-codesys, 0, 0, 0755, $(ECU_CODESYS_DIR)/90_update_codesys_application, /etc/usbmount/mount.d/90_update_codesys_application)
  522.  
  523. -       @$(call install_link, ecu-codesys, /lib/systemd/system/codesys3-rt.service, /etc/systemd/system/application.target.wants/codesys3-rt.service)
  524. +# service disabled for teststand usage
  525. +#      @$(call install_link, ecu-codesys, /lib/systemd/system/codesys3-rt.service, /etc/systemd/system/application.target.wants/codesys3-rt.service)
  526.  
  527.         @$(call install_finish, ecu-codesys)

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at