pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


Quantron check which sensor should be used
Posted by Anonymous on Thu 24th Oct 2019 22:27
raw | new post

  1. diff --git a/ptxdist/local_src/common/ecu_mmc.h b/ptxdist/local_src/common/ecu_mmc.h
  2. index 67f1d15..cf8c008 100644
  3. --- a/ptxdist/local_src/common/ecu_mmc.h
  4. +++ b/ptxdist/local_src/common/ecu_mmc.h
  5. @@ -42,6 +42,12 @@ struct qa_mmc_dev {
  6.     struct device* mmc_device;
  7.  };
  8.  
  9. +/* fixme: enum?? */
  10. +#define COMP_CAP_DEV_SENSOR_UNKNOWN            (0)
  11. +#define COMP_CAP_DEV_SENSOR_WALTERSCHEID       (1)
  12. +#define COMP_CAP_DEV_SENSOR_FAG                        (2)
  13. +unsigned int get_comp_cap_dev_sensor_mode(void);
  14. +
  15.  extern int qa_mmc_calc( struct qa_mmc_dev *dev );
  16.  
  17.  extern int get_cnt_value( struct comp_cap_dev *dev, int* value );
  18. diff --git a/ptxdist/local_src/ecu01-comp-cap/mmc.c b/ptxdist/local_src/ecu01-comp-cap/mmc.c
  19. index 75fb52c..9d2cd05 100755
  20. --- a/ptxdist/local_src/ecu01-comp-cap/mmc.c
  21. +++ b/ptxdist/local_src/ecu01-comp-cap/mmc.c
  22. @@ -75,6 +75,44 @@ static struct qa_mmc_dev mmc = {
  23.        }
  24.  };
  25.  
  26. +unsigned int get_comp_cap_dev_sensor_mode(void)
  27. +{
  28. +       static unsigned int comp_cap_dev_sensor_mode = COMP_CAP_DEV_SENSOR_UNKNOWN;
  29. +#define PIN_V_NAMUR_VALID       32    //IMX_GPIO_NR(2, 0)
  30. +#define PIN_V_SENSOR_VALID      40    //IMX_GPIO_NR(2, 8)
  31. +
  32. +       if (comp_cap_dev_sensor_mode == COMP_CAP_DEV_SENSOR_UNKNOWN)
  33. +       {
  34. +               int iRet;
  35. +               iRet = gpio_get_value(PIN_V_NAMUR_VALID);
  36. +               (void)printk(KERN_EMERG "pin namur = %d\n");
  37. +               iRet = gpio_get_value(PIN_V_SENSOR_VALID);
  38. +               (void)printk(KERN_EMERG "pin namur = %d\n");
  39. +               if (iRet)
  40. +                       comp_cap_dev_sensor_mode = COMP_CAP_DEV_SENSOR_FAG;
  41. +               else
  42. +                       comp_cap_dev_sensor_mode = COMP_CAP_DEV_SENSOR_WALTERSCHEID;
  43. +      
  44. +               /* print diag once */
  45. +               switch(comp_cap_dev_sensor_mode)
  46. +               {
  47. +                       case COMP_CAP_DEV_SENSOR_WALTERSCHEID:
  48. +                               (void)printk(KERN_EMERG "ecu01-compcap: running in FAG mode.\n");
  49. +                               break;
  50. +                       case COMP_CAP_DEV_SENSOR_FAG:
  51. +                               (void)printk(KERN_EMERG "ecu01-compcap: running in FAG mode.\n");
  52. +                               break;
  53. +                       default:
  54. +                               (void)printk(KERN_EMERG "ecu01-compcap: running in unsupported mode=%d.\n",
  55. +                                       comp_cap_dev_sensor_mode);
  56. +                               break;
  57. +               }
  58. +       }
  59. +
  60. +       return comp_cap_dev_sensor_mode;
  61. +}
  62. +
  63. +
  64.  /*
  65.   * Open and close
  66.   */
  67. @@ -92,6 +130,10 @@ static int qa_mmc_open(struct inode *inode, struct file *file)
  68.     if (dev == NULL)
  69.        return -1;
  70.  
  71. +   /* Init sensor mode */
  72. +   /* fixme: |open()| should fail if we cannot get the info */
  73. +   (void)get_comp_cap_dev_sensor_mode();
  74. +
  75.     //init 0-1-2
  76.     //start 1-0-2
  77.     // Initialisierung
  78. diff --git a/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c b/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  79. index 8fc2ae9..5a14f51 100644
  80. --- a/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  81. +++ b/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  82. @@ -263,7 +263,7 @@ int qa_mmc_calc( struct qa_mmc_dev *dev )
  83.        // Interrupt from these signals should be preventet by disabling them if the bridge from Pin C3 to C4
  84.        // is installed for FAG Sensors
  85.  
  86. -      if ( 0x6 == (i_mmc_error & 0x6) ) {
  87. +      if (get_comp_cap_dev_sensor_mode() == COMP_CAP_DEV_SENSOR_FAG) {
  88.  
  89.          // There are 2 cases for shorter period than before
  90.          // 1. Normal: The periode decereased because the speed raised.

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